Skip to Content
author's profile photo Former Member
Former Member

getting records using mdm java api

Hi All,

i had created a programme to get the data form the mdm using java api's. i am getting the tables details , field details .

but i am not getting proper code for geting records . send any sample code to get the records from the table. please help me.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 04:22 AM

    Hi,

    Please check out the below code

    FieldProperties[] fields = getFieldListCommand.getFields();

    FieldId[] fid=new FieldId[69];

    Search s=new Search(mainTableId);

    ResultDefinition rd=new ResultDefinition(mainTableId);

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

    {

    fid<i>=fields<i>.getId();

    }

    rd.setSelectFields(fid);

    RetrieveLimitedRecordsCommand ret=new RetrieveLimitedRecordsCommand(simpleConnection);

    ret.setSession(session);

    ret.setResultDefinition(rd);

    try

    {

    ret.execute();

    }

    catch(Exception e)

    {

    }

    RecordResultSet rs=ret.getRecords();

    for(int i=0;i<rs.getCount();i++)

    {

    Record r=rs.getRecord(i);

    System.out.print(rs.getDisplayValue()); //this will display only the display fields of the repository

    }

    //you can also use the beolw method to display all the field values irrespective of whether the field is Display field or not

    for(int j=0;j<fields.length;j++)

    {

    if(fields[j].getType()==7 || fields[j].getType()==42)

    {

    System.out.print(fields[j].getCode()" - "r.getLookupDisplayValue(fields[j].getId())+"# ");

    }

    else

    {

    System.out.print( fields[j].getCode()" - "r.getFieldValue(fields[j].getId())+"# ");

    }

    }

    Hope it helps

    Regards,

    Jitesh Talreja

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.