Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Variable not being included in XML data file output

Level 4
Level 4
This seems like it should be obvious, but I've struggled with this for a couple of days.

As a programming principle, I like to make the form as "smart" as possible and the resulting Word templates, or XML documents as simple as possible. I need to be able to set a "flag" that would be in the XML data file if certain conditions are met, e.g.,

if (field1.rawValue == "0"){variable1 == "1"};

if (field2.rawValue == "0") {variable1 == "1"}; etc.

The problem that I'm having is that I can't seem to get variable1 to be included in the XML data file that the form creates.

Help! This seems like it should be so simple but I'm baffled.

1 Reply
Not applicable
The variable you're setting does not fall within the scope of the xml output (it's scope is only within the execution of the form).

Try creating a variable (Using File > Form Properties >Variable) and assigning your value to it (variableName.value = 1).

One note of warning, you'll want to trigger the validation event every time the form is opened or your value will return to the default value when users re-open the form.