How to access links to a Record owned by different database for a table in the STK?

Options
nblum
nblum Member Posts: 4
First Comment

I am attempting to report on all linked records for records in a specific table. However, I've realized that one of the link groups I'm trying to get information about is actually owned by a different database, and is not showing up in the Record.links property? Is there any way to find this link in the STK without searching through the other database for any records that link to my specific record?

There is a get_associated_records function from the record object, but that requires a tabular attribute, which is not the use case I'm looking for.

It doesn't make a lot of sense to me that a Record would be unaware of link groups it was a part of, or that there would be no way to query that information without taking an entirely different approach.

Also, slightly related, I would expect the Table.bulk_link_fetch method to throw an error if I attempted to fetch a link group that "doesn't exist" (at least to the Record in the current context), rather than getting the error later on when I try to access that link group directly.

Any suggestions or pointers would be greatly appreciated! Thank you!

Best Answer

  • Andy_Grigg
    Andy_Grigg Member, Employee Posts: 27
    Name Dropper First Answer First Comment First Anniversary
    Answer ✓
    Options

    There's two distinct things here, I'll answer both questions separately.

    Firstly, you're correct about the behavior of cross-database record link groups (rlgs). The Record.links property is populated based on the rlgs defined in the parent table, which in turn is a subset of all rlgs in the database. However, only rlgs in the database are included there, not rlgs in other databases. Since cross-database rlgs live in a single database only (the 'from' database), they will not appear in the record in the 'to' database.

    This is the current behavior, which ultimately derives from how Granta MI itself is built. I will think if there's anything we can do to improve this behavior for the end user. The obvious improvement might be to iterate through rlgs in all databases for an rlg that links to the requested database and table of the record, and then to augment the list of rlgs on the record. This could be a reasonably expensive operation though, depending on the number of databases loaded on the server. We'll look into it though, and see if any improvements can be made here.

    The second issue is I believe fixed in Scripting Toolkit 4.0, to be released with Granta MI 2024 R2. Is this the same issue? https://discuss.ansys.com/discussion/2885/table-bulk-link-fetch-in-stk-3-3-202#latest

Answers

  • nblum
    nblum Member Posts: 4
    First Comment
    Options

    Hi Andy,

    Thanks for getting back to me!

    For the first issue, I imagine it's less a matter of the Table not knowing that it's being linked to, and more of an issue of the SOAP layer not providing that information? MI Viewer loads those cross-database links, so somewhere the table knows about that cross-database link. It sounds like tricky stuff regardless. I'm open to discussing more potential ideas if you'd like.

    For the second issue, yes, that does look like the same issue I am encountering. I'm looking forward to version 4.0 of the STK!

    Thanks,
    Noah

  • Andy_Grigg
    Andy_Grigg Member, Employee Posts: 27
    Name Dropper First Answer First Comment First Anniversary
    Options

    Well, I don't want to get too much into the architecture of Granta MI. Suffice it to say that we don't readily have access to that information in Scripting Toolkit, hence the need for a workaround.