Description


Somtimes is necessary to hand over the name (and not the content) of a field to a subroutine. Using a string containing this name is not the problem but you got no compiler warnings if the name is misspelled or the field itself not exists. So it would be a good idea to have a function which convert a field to its name.

Use Case


\\\"Now: call LP_FNC(\\\"\\\"FIELD.ENTITY\\\"\\\") Better: call LP_FNC($nameof(FIELD.ENTITY)) where $nameof() is an operator to convert the field into its name. Statement Result $nameof(FIELD) \\\"\\\"FIELD.ENTITY\\\"\\\" $nameof(FIELD.ENTITY) \\\"\\\"FIELD.ENTITY\\\"\\\" $nameof(xyz) warning: 1000 - Field \\\'XYz\\\' not found\\\"

Importance


Import because you move the check of the existing of a field from runtime to compiletime

Type


Scripting/Coding

Operating System


Not Applicable

Status


Closed

One thought on “Convert field(name) to string”

  1. Status = Closed
    This can be accomplished by using the $fieldname function with the name of the field as parameter.
    Example:

    call lpSomeLocalProc($fieldname("A.DUMMY"))
    end

    entry lpSomeLocalProc
    params
    string pFieldName : IN
    endparams

    ; Some code goes here

    end

Leave a Reply