Hello!
I have another question about VFE, this one involving document variables.
The documentation made me believe that I can take an input component and have it affect a document variable. However when I try to use this document variable in my text component, nothing ever shows up. Here's what I'm doing:
- Create the input, in this case just a text box.
- Set the type to document variable and create the variable name. The "make visible to other forms" box is NOT checked.
- The form itself is set to output to variable.
In my text component, I tried to access this variable in various ways, but always came up with nothing:
- {DOCUMENT.VARIABLE_NAME}
- {gFormName_FORM.VARIABLE_NAME}
- {DOCUMENT.gFormName_FORM.VARIABLE_NAME}
- {VARIABLE_NAME}
None of the above worked for me. I am probably missing some special checkbox somewhere. I'd prefer to use document variables over observation terms for what I'm doing with this data. Is there something I need to do to get these variables to populate?
On a second note, can document variables be continuously updated, ala {'{DOCUMENT.VAR}'} ?
Thank you.
You need to check that box that says make visible to other forms, if you do not check it, VFE will append some sort of timestamp to the variable name, like DOCUMENT.TEMP (TEMP is the name you set as variable name) will turn into DOCUMENT .TEMP_4907_915_1354639139. Then in order to reference it from the text component you would need to use the full DOCUMENT .TEMP_4907_915_1354639139 which could change every time you save and import a new version of the form. If you check the box, you only need to reference its given name, DOCUMENT.TEMP.
And yes you should be able to do {'{DOCUMENT.VAR}'}.
To expand on what Michael is saying - the 'make available to other forms' check box converts the local DOCUMENT. variable to a global DOCUMENT. variable.
Why is this step needed?
The editor attempts to uniquely name each local variable in an effort to avoid collisions. As a standard, established by Medicalogic, the workstation ID, site ID and timestamp is used to append to the variable name you create. If you check that box, the append does not occur, which is why it is important to name these type of DOCUMENT. variables as uniquely as possible.
Ever 'borrow' content from a form and the variable names already have the append?
Unless you remove the original append, it will be appended again in the final code. Two appends can take up a lot of valuable code space, especially if you have a form nearing max size. Always clean up the code.
Thanks for the explanations everyone, This really helps.
I got everything working the way I want now, but it looks like I have to use the fmt or cfmt command to display the vars, and I can do the constant evaluation on them.
I will keep those caveats in mind, Lee. Thank you.