SDK: How to determine lplAttrRecordIds for a document?

I'm trying to use aaApi_GenerateDocumentCodeDlg in a custom document command being called via a MRR. The SDK documentation only shows 2 prototypes for document commands via MRR's, and both only provide for document and project id's to pass to a custom document commands, but no AttrRecordIds.

Given that I have access to the project and document id's, is there a SDK function that will return an array of AttrRecordIds for a particular document? Or perhaps a buffer?

I think it would be better if I can use aaApi_GenerateDocumentCodeDlg if I could determine those value(s), instead of what I am doing now, which isn't working anyway. I've searched for sample code that uses aaApi_GenerateDocumentCodeDlg but have turned up nothing, and I've been through the SDK documentation repeatedly and still haven't been able to figure this out.

  • Thanks, Dean. I've updated the SDK documentation for aaApi_GenerateDocumentCodeDlg and aaApi_SelectLinkDataByObject.

     



  • Thanks DeanLyon. I had been looking at that before, and had tried something similar before, but it didn't work, and I was getting hung up in the verbiage of the SDK documentation. I'll give it another shot.

    Please note that I post here on a voluntary basis and am not a Bentley employee. 

  • You are looking for the LinkData commands.  

    You will need the TableID for the Environment Table you want attributes from.  Use aaApi_SelectAllTables  with aaApi_GetTableStringProperty(TABLE_PROP_NAME,indx) to find the one with the name you want and save the ID with

    aaApi_GetTableNumericProperty(TABLE_PROP_ID,indx) to get TableID which is what you need for the first argument of

    LONG lColCount;

    aaApi(tblId /*gotten from above*/, AADMSLDT_DOCUMENT, FodlderID, DocumentID, NULL /*no where clause applied*/, &lColCount /*to hold the number of columns returned in the buffer */, NULL /*return all columns*/,NULL /*no flags*/)

    Retrive the values with aaApi_GetLinkDataColumnValue and aaApi_GetLinkDataColumnValuePtr

    LONG AAAPI aaApi_SelectLinkDataByObject
    (
    LONG lTableId, /* i Table identifier (required) */
    LONG lItemType, /* i Reference Item type */
    LONG lItemId1, /* i First item identifier */
    LONG lItemId2, /* i Second item identifier */
    LPCWSTR lpctstrWhere, /* i Where statement (optional) */
    LPLONG lplColumnCount, /* io Column count in lplColumnIds */
    LPLONG lplColumnIds, /* i Columns to fetch (NULL - all) */
    ULONG ulFlags /* i Flags (AADMSLDSF_XXX) */
    );