Tuesday, 12 July 2011

Code to Get the value of lookups by providing lookup name

public String getLookupVals(String lookupName)
{
HashMap lookup = new HashMap();
try {
tcResultSet tcresultSet = molookup.getLookupValues(lookupName);
for (int i=0; i < ((tcResultSet) tcresultSet).getRowCount(); i++){

((tcResultSet) tcresultSet).goToRow(i);
String code = tcresultSet.getStringValue("Lookup Definition.Lookup Code Information.Code Key");
tring decode = tcresultSet.getStringValue("Lookup Definition.Lookup Code Information.Decode");
System.out.println("Key : "+ decode+"\tValue :"+code); }

System.out.println("End of loop");

} catch (tcAPIException e) {
e.printStackTrace();
} catch (tcInvalidLookupException e) {
e.printStackTrace();
} catch (tcColumnNotFoundException e) {
e.printStackTrace();
}

return("Success");
}

No comments:

Post a Comment