In this post we will discuss how we can declare a hidden variable in InfoPath form. We can use hidden variables to keep track of any value or any flag according to the requirement.
Also check out:
There are two approaches we can declare a hidden variable.
Put a textbox control from the controls section from the Home tab in the Ribbon. Once you put a textbox, the textbox will appear in the form and a field will be added into the Fields list.
Then delete the textbox from the form, remember if you will delete the field from the form it will not delete the field from the field list. So you can right click the field and the Field Properties and then you can set values in Field and Group Properties dialog box. This field will work as your hidden variable.
From the Fields, click on Add Field as shown in the fig below:
Then in the Add Field or Group dialogbox give the display name for the field, Name and you can also chose the Data Type.
Also if you want to give some default value then you can set.
Then click on OK. This will also work as a hidden variable. Appreciate your comment if something is wrong or you want to suggest something.