Plex 2E

  • 1.  How to get the name of a field value

    Posted Jul 25, 2017 02:47 AM

    The scenario is this: I have a field, e.g. Invoice Status, that is a FIELDS/Status. The names of the values of the field are like Sent, Paid, Closed, and the literals of the values are like S, P, C.

     

    How can I get the name of the current value in the field? I would like to store the name of the value to a string field.

     

    Implementation language of the application is RPG 400.



  • 2.  Re: How to get the name of a field value
    Best Answer

    Posted Jul 25, 2017 03:25 AM

    Have you looked at the following discussion?

    https://communities.ca.com/message/14653600



  • 3.  Re: How to get the name of a field value

    Posted Jul 25, 2017 08:28 AM

    Thanks, I will look at that.



  • 4.  Re: How to get the name of a field value

    Posted Aug 21, 2017 05:53 AM

    Thanks, I got the name of field values with code like this:

     

    +++Define  Field: FIELDS/+Name
    Set  TestingL<Invoice Status> = <Invoice Status.Complained>
    Set  WorkL<JuhoheTest.Field Name> = <JuhoheTest.Field Name.Invoice Status>
    +For Each Field  TestingL
         +++Set Value To Current  Field: FIELDS/+Name
         ++Name Defined  Field: FIELDS/+Name, WorkL<HelpString1>, .Language
         If  WorkL<HelpString1> == WorkL<JuhoheTest.Field Name>
            +For Each Field Value
            +++Set Value To Current  Field: FIELDS/+Name
            ++Name Defined  Field: FIELDS/+Name, WorkL<HelpString1>

     

    The human readable name of the value is stored in field WorkL<HelpString1>

     

    The discussion linked by Teemu Simolin contains the solution for my problem.



  • 5.  Re: How to get the name of a field value

    Posted Aug 24, 2017 10:23 AM

    If you are generating for the green screen, then building the Field Values file will create a database of legitimate values for a field.  This is to support the prompting, but you can write your own fetch functions over the same database.  Otherwise I tend to do as George Jeffcock does and make a little function.  Pass it the "value" and it will use meta code to generate a list of known field values, and return the matching one.