1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

OpenEdge get data-type of property value that is retrieved using DYNAMIC-PROPERTY

Discussão em 'StackOverflow' iniciado por fdantas, Janeiro 10, 2018.

  1. fdantas

    fdantas Administrator Moderador

    I have to use the DYNAMIC-PROPERTY function in OpenEdge to get data out of a class.

    So far this works just fine, but now I would like to know the data type of the values that was retrieved. This is required because the values are formatted based on the data type.

    So for example:

    CLASS Customer:
    DEF PUBLIC PROPERTY Name AS CHAR NO-UNDO
    GET.
    SET.

    DEF PUBLIC PROPERTY Email AS CHAR NO-UNDO
    GET.
    SET.

    CLASS Invoice:
    DEF PUBLIC PROPERTY Amount AS DECIMAL NO-UNDO
    GET.
    SET.

    DEF PUBLIC PROPERTY Customer AS Customer NO-UNDO
    SET.
    GET.


    In another procedure I would like to do something like this:

    DEF INPUT PARAM oInvoice AS Invoice NO-UNDO.

    DEF VAR theValue AS Progress.Lang.Object NO-UNDO.

    theValue = DYNAMIC-PROPERTY(oInvoice, "Amount").

    IF theValue:WHATS-THE-TYPE = "decimal" THEN
    RETURN STRING(theValue, ">>>>>9.99").
    ELSE
    RETURN TRIM(theValue). // It is a character field


    Since I don't know the type at runtime, I can't format the value.

    In a later stage I would even want to get the property values of the customer.

    IF theValue:WHATS-THE-TYPE = "Customer" THEN
    RETURN DYNAMIC-PROPERTY(theValue, "Name").

    Continue reading...

Compartilhe esta Página