How to add items with dual values on a combo box

How to add items with dual values on a combo box

This tutorial show you how to create an item on a combo box that implements two values, one will be the key value of the item and the other would be the description of the item. You can achieve this by creating a custom API function to add the items to the combo box, please follow these instructions to create and implement that API function.
  1. Create these fields on Plex:
    a) Control+

    b)
     Method_




    c)
    InternalValue


    d)
    ExternalValue





  2. Create a new source code object called “AddComboValue” and add these parameters: 

    ·         FIELDS/Function

    ·         FIELDS/Control (Will contain the control name of the combo on which the new item will be added)

    ·         FIELDS/Method

    ·         FIELDS/Param1

    ·         FIELDS/Param2

    ·         FIELDS/Param3

    ·         FIELDS/Param4

    ·         FIELDS/Param5

    ·         FIELDS/RetValue

    ·         InternalValue (contains the key value of the new item)

    ·         ExternalValue (contains the description of the new item)



  3. Add this code to your “AddComboValue”  source code object:

    Object x = new Object();

    ObComboData myobj = (ObComboData)ObUserAPI.callMethod(getFunction(), &(1:), &(2:), &(3:), &(4:), &(5:), &(6:), &(7:), &(8:), x);

    myobj.addValuePair(&(11:).getValue(), new ObCharFld(&(10:).getValue()) );

  4. Open the Action Diagram from your function that uses the combo box and add the following fields on any of your local variables:

    ·         Control+

    ·         Method_

    ·         FIELDS/RetValue

    ·         InternalValue

    ·         ExternalValue





  5. In the Action Diagram, to add a new item on the combo box you just need call your “AddComboValue” source code after set the values of the fields “Control+”, “ExternalValue” and “InternalValue”.

    Example:


    For the values of the other parameters please use the same values we defined in the following image


    NOTE: REMEMBER that the value of the “Control (Control+)” parameter must be the same value of the control name from the combo box in your function, otherwise the API function cannot find the control on which the new item must be added. In our test function we configured the control name with the same value of the “name” triple assigned to the field that we used as combo box, this way we can use the “Name” statement in the Action Diagram to set the same value of the control name in the “Control” parameter, please see the following images to see how we used this, remember that this is just an example and you can use any other method to achieve the same result:






  6. Generate your function and test it:







    • Related Articles

    • Provide a Method to Calculate Values for Derived Attributes

      Plex This example will use the entity OrderDetail where a derived field will be added. Enter the following triple: OrderProcessing.OrderDetail has a derived FLD LineTotal. Generate Changes. On the test Model there is an OrderProcessingbuildObjects ...
    • Add Capability to Define the Entry Point of the Application

      The entry point can be specified in the obclient.properties file. Eclipse In Eclipse look for obclient.properties and specify the entry point as the main page, althout it can be the login page too. Add Generation.Custom.EntryView=view.Main In this ...
    • CM WebClient 1.8.8 Release Notes

      Download current GA Release : Download CM WebClient 1.8.8 WebClient Mobile Updates To see the latest updates of WebClient Mobile, please visit: WebClient Mobile repository. What's New? Support Java 11 Complete functionality of DojoTimePicker.ctrl to ...
    • CM evolveIT User Manual

      Welcome to CM evolveIT         User Training Manual                                                             Restrictive Rights This document and the product referenced in it are subject to the terms and conditions of the user License Agreement ...
    • How To...

      1. Group Model Q: How do I change WebClient group model from licensed version to non-licensed version? A: a. Login to your group model and remove the old WebClient group model and add the new WebClient group model from your library list. b. Extract a ...