JPO for Getting Field Range Values (Choices)

When you use a JPO to get field value ranges, you must configure the form field with specific settings.


  • Input Type=combobox / radiobutton / checkbox
  • Range Program=JPO name
  • Range Function=JPO method name

For processing the data, the input parameter can be used by the method. The return type of this method is a HashMap, which contains two StringLists: one for the range values and the other for internationalized range values in the same sequence.

The HashMap should look like the following:

  
Key Value
---------------------------------------------------------------
field_choices range -> Values StringList
field_display_choices -> Internationlized range Values StringList
The JPO function template is provided below:
public static Object methodName(Context context, String[] args) throws Exception
{
    HashMap programMap = (HashMap) JPO.unpackArgs(args);
    HashMap requestMap = (HashMap) programMap.get("requestMap");
    HashMap paramMap = (HashMap) programMap.get("paramMap");
             
    // Get the required parameter values from  "programMap" - as required
    String  objectId = (String) paramMap.get("objectId ");
    String  relId = (String) paramMap.get("relId ");
    String  languageStr = (String) paramMap.get("languageStr"); 
    // initialize the return variable HashMap tempMap = new HashMap();
    HashMap tempMap = new HashMap();
    // initialize the Stringlists fieldRangeValues, fieldDisplayRangeValues
    StringList fieldRangeValues = new StringList();
    StringList fieldDisplayRangeValues = new StringList();
    // Process information to obtain the range values and add them to fieldRangeValues
    // Get the internationlized value of the range values and add them to 
fieldDisplayRangeValues
    fieldRangeValues.addElement(xxx);
    fieldDisplayRangeValues.addElement(internationlised xxx);
    tempMap.put("field_choices", fieldRangeValues);
    tempMap.put("field_display_choices", fieldDisplayRangeValues);
    return tempMap;
}