on 08-27-2009 9:01 AM
Hello,
I'm trying to search a lookup table for specific values using java mdm api. I don't have any recordId or reference to a main table to start with, thus searching the lookup table directly.
If anyone could provide a code example?
Br
Olof
Hi Olof,
You can use the below code for searching a value in lookup table:
ResultDefinition objResultDefinition = new ResultDefinition(Lookup Table Id);
objResultDefinition.addSelectField(Lookup Field ID);
StringValue [] objStringValue = new StringValue[1];
objStringValue[0] = new StringValue("Value to search");
RetrieveRecordsByValueCommand objRetrieveRecordsByValueCommand = new RetrieveRecordsByValueCommand(objConnectionAccessor);
objRetrieveRecordsByValueCommand.setSession(strUserSessionID);
objRetrieveRecordsByValueCommand.setResultDefinition(objResultDefinition);
objRetrieveRecordsByValueCommand.setFieldId(lookup field id);
objRetrieveRecordsByValueCommand.setFieldValues(objStringValue);
objRetrieveRecordsByValueCommand.execute();
RecordResultSet objRecordResultSet = objRetrieveRecordsByValueCommand.getRecords();
Now using the objRecordResultset in a loop you can get the record id by calling the getRecord(i).getId() method.
Hope this helps!!
Cheers,
Arafat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.