Move records without losing Meta-attributes with STK 3.1

mikcapelli Member, Employee Posts: 5
First Anniversary First Comment Ansys Employee
edited June 2023 in Materials


Here is a question I got from a customer using Python STK 3.1

My Goal is to move existing records in the correct folder based on the attribute “Heat Treatment Type” ’s value.

In the example below, if the two records have the value “Stress Relieved”, they should be moved to the corresponding folder:

I have to do that for multiple tables and multiple records. I believe using the Record Manipulator would be time consuming so I started using the Granta MI Scripting Toolkit.

So far, I was able to copy the record to the correct folder and delete the old one using the dataImportService & DeleteOrWithdrawRecord but this is not satisfying as I am losing the original pseudo-attributes like the date the record was created or the author etc.

Do you have any suggestions ?

Many Thanks,


Best Answer

  • Doug Addy
    Doug Addy Member, Employee Posts: 21
    First Anniversary Name Dropper First Answer Ansys Employee
    edited July 2023 Answer ✓

    Using the STK you are not currently able to move a record without losing the metadata, as you observed you can copy a record using the Foundation Layer DataImportService

    There is a service you can use, but you will need to use something like requests, as there is no python client at present. To see the documentation for this service you can navigate to https://my.mi.server/mi_servicelayer/RecordManipulator/v1.svc/Help.

    Here's an example of a short script that should allow you to move a record, targeted against the MI Training database. It should move the T6 titanium record from the 7075 folder to the parent 7000-series (Zn-alloyed) folder in the MaterialUniverse table.

    import requests
    from requests.auth import HTTPBasicAuth

    db_key = "MI_Training" record_history_to_move = "c0692c05-6dc1-4e58-8271-dc5d9815018b" new_parent_history_guid = "3cc2d114-e9db-42bf-acc7-05f16fad617d" user_name = "MY_USERNAME" password = "MY_PASSWORD" hostname = "my.mi.server" manipulator_url = f"http://{hostname}/mi_servicelayer/RecordManipulator/v1.svc/move" request = {
    "DatabaseKey": db_key,
    "NewParentHistory": new_parent_history_guid,
    "RecordHistory": record_history_to_move

    authenticator = HTTPBasicAuth(user_name, password=password)
    response =, json=request, auth=authenticator) print(response)

    For production use you will want to consider using HTTPS, and not using basic authentication of course!