Skip to Content
avatar image
Former Member

Display lookup field record values for the main table (dynamically)

Hello All,

I wanted to display all the records(text, lookupfields, qualified) in any given repository. And this should happen dynamically, ie If the user selects the table name from a drop down he must be able to see all the records relating to it. Iam able to get the simple fields but not able to get the lookup table records, below is my code which works for simple fields, what changes should i make to display the qualified records too. can anyone please help.


String selectedTable = wdContext.currentVnDropdownElement().getVaresult();

ResultSetDefinition resultdefenition = new ResultSetDefinition(selectedTable);

for(int i=0; i<code.length;i++)




Search search = new Search(selectedTable);

A2iResultSet rs = catalog.GetResultSet(search, resultdefenition, null, true, 0);

int recordCount = rs.GetRecordCount();

Value value2 = null;

for (int ij=0; ij < recordCount; ij++)


IPrivateLogin.ITableValuesElement TableEle=wdContext.createTableValuesElement();


for (int j = 0; j < rs.GetFields().GetCount(); j++)


value2 = rs.GetValueAt(ij,j);

if (value2.IsNull())


value2 = value2.Set("NA");





}catch(StringException e){

wdComponentAPI.getMessageManager().reportSuccess("INSIDE CATCH BLOCK" + e);


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    May 09, 2007 at 01:48 PM

    Hello Suresh,

    A2iResultSet rs = catalog.GetResultSet(search, resultdefenition, null, true, 0);

    //Get lookupfield -->You have to get the id instead the value. Then access to the main table with the id. Example: position = number of record of the resultset, lookckupfieldname = name of the lookupfield

    A2iIntArray agArray = rs.<b>GetLookupIDAt</b>(position,lookupfieldname);

    //Go to main table to get the "real" value

    int tableID = agArray.getAt(0);

    A2iIntArray ids = null;

    ids = new A2iIntArray();


    rsd = new ResultSetDefinition(tableName);


    Search search = new Search(mainTableName);

    resultSet = catalogData.<b>GetRecordsById</b>(rsd, ids);

    //Get qualified fields --> with the recordID first get the qualifiedlink of the fieldwanted. After, for each link go to find it "real2 value. Example:

    // Get the recordID

    Search search = new Search(tablename);

    QualifiedLinkArray qualifiedLinkArray;

    // get the qualifer qualifiedLink of the record

    qualifiedLinkArray =

    catalogData.<b>GetQualifiedLinks</b>(search, tablename, qualifiedfieldname, recordId);

    for (int i = 0; i < qualifiedLinkArray.GetSize(); ++i)


    // get qualifiedLink

    QualifiedLink qualifiedLink = qualifiedLinkArray.<b>GetQualifiedLinkAt</b>(i);

    // get the lookup Record value

    int id = <b>qualifiedLink.GetLookupID</b>();

    //With this id you can go to the main table an gets the values that you want



    Add comment
    10|10000 characters needed characters exceeded