Plex 2E

  • 1.  Access value's literal in meta code

    Posted Aug 22, 2017 04:21 AM

    Is it possible to access literal value of a field? My scenario is such: I have a string field name HelperString which has literal content. The text literal is "Complained", "Sent", "Deleted", e.g. telling an invoice status. Now I have a field InvoiceStatus which is a character field of length 1 and has many values, such as "Complained" (literal value "C"), "Sent" (literal value "S"), and "Deleted" (literal value "D"). I would like to loop through values of InvoiceStatus and set InvoiceStatus's current value to be the one with name given in HelperString.

     

    So is it possible to set value of a field using the name of the value that has been given as a string?

     

    I have tried like this:

     

    +++Define Field: FIELDS/+Name

    +For Each Field InvoiceDataL

        +++Set Value To Current Field: FIELDS/+Name

        ++Name Defined Field: FIELDS/+Name, WorkL<TextField1>, .Language

        If WorkL<TextField1> == <FieldName.InvoiceStatus>

            +For Each Field Value

                +++Set Value To Current Field: FIELDS/+Name

                ++Name Defined Field: FIELDS/+Name, WorkL<TextField2>, .Language

                If WorkL<TextField2> == WorkL<HelperString>

                   // Same value found, both TextField2 and HelperString have literal text, e.g. "Deleted".

                   // However, how can I find out now that InvoiceStatus's value Deleted has literal "D"? How can I assign this literal value to another field, e.g. WorkL<InvoiceStatus>?



  • 2.  Re: Access value's literal in meta code

    Posted Aug 22, 2017 05:55 AM

    I solved my problem using a source code function. I had to hard code value names as strings in the source code. It seems to work.

    However, if anyone knows the answer to my question, it would be nice to know.



  • 3.  Re: Access value's literal in meta code
    Best Answer

    Posted Aug 22, 2017 09:15 AM

    you need to look at ++Text Defined

    ++Text Defined

    Generates a Text statement for the object that is the current value of a specified meta-variable. This enables you to retrieve the large property or narrative text associated with the object. For example, you could retrieve the literal text of a label or value object. This can be useful for generating reports about the objects in your model.