Skip to Content
0

How to read a context variable in formcalc

Jul 06, 2017 at 09:39 PM

101

avatar image

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

antoine foucault Jul 10, 2017 at 07:03 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Daniel St-Jacques Jul 11, 2017 at 01:39 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Daniel St-Jacques Sep 22, 2017 at 03:36 PM
0

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";

Share
10 |10000 characters needed characters left characters exceeded