Skip to Content

How to read a context variable in formcalc

I have a global variable in the context. That variable (type CHAR01) contains only "X" or space.

When the variable contains "X" one of the subform should hide.

The variable is not displayed in any subform.

Here is the Formcalc script I used without success at the subform initialize event.

if( HIDEFLAG eq "X") then

$.presence = "hidden"

endif

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Jul 10, 2017 at 07:03 PM

    Hi Daniel,

    It depends where the variable is placed in the scheme.

    If you don't mind JavaScript over FormCalc, here are some examples:

    this.rawValue == 'X' or this.rawValue <> null

    this.parent.rawValue == true

    this.parent.parent.rawValue etc...

    if (this.SW_PRINT_SUPPLEMENT.rawValue == null )

    { this.presence = "hidden";

    }

    Best,

    Antoine

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 11, 2017 at 01:39 PM

    Hello Antoine

    Using "this.rawValue" indicate the variable is somewhere in the form layout.

    In my case that variable is not used in the layout. It has been created only to allow the layout to react based on the value in it.

    A global variable "HIDEFLAG TYPE CHAR01" has been created at the interface level.

    The initialization of the variable has been done in the initialization code.

    CLEAR hideflag.

    IF <condition>.

    hideflag = 'X'.

    ENDIF.

    The Global variable has been included in the context of the form.

    That variable is not display anywhere in the form. It has been created only to use it to hide some subforms.

    Regards

    Daniel

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 22, 2017 at 03:36 PM

    For the benefits of all.

    As Antoine suggested, the variable has to be part of the subform you are working in.

    The "presence" property, found in the Object->Fleds tab, can be changed from visible to hidden.

    So the variable will not be display but can be used by the Formcalc or Javascript.

    Example:

    Is a subform named "PAGE1", a TextField "langu" is bind to a global variable and is containing "EN"

    In the subform PAGE1 you need to hide another subform name "French", you can put in the initialized event of the subform "French" the following javascript:

    if (this.resolveNode("langu").rawValue == "EN") {
    this.presence = "hidden";
    }
    else this.presence = "visible";

    Add comment
    10|10000 characters needed characters exceeded