Creating Generic Records with Python Scripting Toolkit

Daniel Manocchio
Daniel Manocchio Member Posts: 24
10 Comments First Anniversary 5 Likes Photogenic
**

Hi Guys,

I have to create a number of generic records and would like to do that via STK. I'd be totally fine with either

  • first creating regular records and transforming them to generic ones in a second step or
  • create them directly.

If found the 'recordType' property in rec.pseudo_attributes, however its value can't be set via STK. Is there any way to modify this by STK?

Thanks in advance & bests,
Daniel

Best Answer

  • Ludovic Steinbach
    Ludovic Steinbach Member, Employee Posts: 2
    First Answer First Comment First Anniversary
    ✭✭✭
    Answer ✓

    Hi Daniel,

    There are multiple ways to create generic records with the MI Scripting Toolkit.

    • To convert an existing record to a generic record, import records as children of the record. It will be converted automatically.
    • To convert an existing folder to a generic record, import data to the folder. It will be converted automatically.

    For new records:

    • Create the record and set its type to folder:

      • new_record = table.create_record(name=name, folder=True)
      • new_record = table.create_record(name=name); new_record.type = "Folder"
    • Populates attributes on the record, then import

    In the upcoming version of the STK, the documentation for this topic has been improved.

    As a side note: in general, pseudo-attributes are read-only. The few pseudo-attributes that are writable are available as properties on the Record class: Record.type, Record.name, Record.short_name, Record.subsets, Record.color.

    I hope this helps,
    Ludovic

Answers

  • Daniel Manocchio
    Daniel Manocchio Member Posts: 24
    10 Comments First Anniversary 5 Likes Photogenic
    **
    edited April 17

    Hi Ludovic,

    Uh, that's really incredible simple - I'd never tried that by my own =D
    Many thanks for that great answer :)

    Bests,
    Daniel