Hi there,
I am coming from VBA background and have a very simple question for you guys.
I would like to make a visibility region visible/invisible by calling it from code. Is it possible to do that in VFE? Please advise!
Thanks
Simon
If I understand what you're asking, the answer is yes. Let's say you have a visibility region that you only want to appear when the patient is > age 18. One exception...if the user clicks a button that says "Hide additional questions", this visibility region disappears. You can accomplish this with a document variable (DOCUMENT.HIDE) that has no value when the form is launched.
Code for Visibility Region
{PATIENT._AGEINMONTHS => 216 AND DOCUMENT.HIDE <> "HIDE"}
Code when button is clicked
{DOCUMENT.HIDE = "HIDE"}
Hi Chaddix,
Thanks for your help! I have a couple more questions related to this...
If my visibility region is called "PersistentAsthma", should the codes be:
To make that appear on the screen (When the form is launched)
{Document.PersistenAsthma.HIDE = ""}
To make that disappear on the screen
{Document.PersistenAsthma.HIDE = "HIDE"}
Thanks again for your help,
Simon
Unless I am mistaken, visibility regions don't have names. You create a visibility region, objects reside in the visibility region, and whether or not these fields are visible is dependent on the rules you set up within your visibility region.
Are you using VFE or EFE to create this form?
I am using VFE to create the form.
Should the text in the "label" be their names?
I have a few visibility regions on the form, can they be set visible/invisible separately by using the code ? {DOCUMENT.HIDE = "HIDE"}
Thanks a lot,
Simon
Visibility regions are only if statements. So, hiding and showing what is contained within the visibility region is based solely on the if statement. So, you would need to put the following in your visibility region:
DOCUMENT.PersistenAsthma <> "HIDE"
Now, whenever DOCUMENT.PersistenAsthma is equal to HIDE, it will hide everything in it. You cannot use DOCUMENT.PersistenAsthma.HIDE, because document variables are just strings and do not have any attributes.
It works!! 🙂
Thanks a lot for all of your helps!!
Have a nice day
Simon
Hi everyone,
I have one more question related to this...
I would like to detect if an visibility region is enabled or not by running this if statement.
if {Document.PersistenAsthma<>"HIDE"} Then
//do the followings
End if
It always thinks that the visibility region is enabled.
Can someone tell me what is the problem? Thanks for your time!
Simon
If you're putting this in the code section on the right (in VFE anyway), just use this:
{
if DOCUMENT.PersistenAsthma <> "HIDE" then
//do stuff
endif
}
Hi everyone,
I am running my form with the code listed above and still having this problem. The code always thinks that the visibility region is enabled. Anyone has any suggestions? Please help!
Thanks
Simon
What determines the value of DOCUMENT.PersistenAsthma? Are you able to show and hide the visibility region within the form?
Also, it may be helpful to upload your form so we can take a look and help you out some more. There might be other things happening that are keeping this from working.
I am able to show and hide the V.R.
The program is not able to determine if the V.R. is hidden or not.
The code that I use is the following.
If DOCUMENT.PersistenAsthma <> "HIDE" then
//do stuff
endif
schung said:
I am able to show and hide the V.R.
The program is not able to determine if the V.R. is hidden or not.
The code that I use is the following.
If DOCUMENT.PersistenAsthma <> "HIDE" then
//do stuffendif
I don't see anything wrong with this MEL. I have to ask however...are you consistent with your variable name? In the third message in the thread, you referred to DOCUMENT.PERSISTENTASTHMA...all subsequent messages were missing the T and the variable was DOCUMENT.PERSISTENASTHMA.
I'm throwing it out there because a good chunk of my MEL "errors" are simply mis-typing.
That is just a typo. My fault! 🙂
I have it spelled correctly in my code.
schung said:
That is just a typo. My fault! 🙂
I have it spelled correctly in my code.
Worth a shot!
If you upload your form, someone here could probably take a look at it and help figure out what is going on.