Accessing the value of a Field in another Form within a Multi-form (mydata)

As a general rule you can only access the value of a Field on the Form you have open. If you are building a Multi-form project, then you are likely to want to access the value of Fields on other Forms within your project. You can do this a couple of ways.

Using ‘cloned’ Fields on each Form

The first, and most straight-forward, is to create a new simple ‘text field’ on your Form and give it the same name as the Field on the other Form. The second Field becomes a ‘clone’ of the original Field on the other Form.

When the two Forms load as a Multi-Form, the value of the Field will be loaded into both Forms, so if you change the value on one Form, it will change the value on the other Form. Furthermore, you will be able to access the value of the Field on both Forms.

If you only want users to be able to change the value on one of the Forms, then you make the Field a ‘hidden‘ Field on the other Form.

This method will enable you to use the Field value in the Rules Wizard and in Scripts.

Using ‘mydata’ to access the Multi-form datafile

The other method only allows you to access the Field value within Scripts, but it saves you the bother of creating matching cloned Fields on each Form. This method accesses the underlying datafile for the entire Multi-form using the ‘mydata‘ command.

To access the value of a Field anywhere within your Multi-form, you put the prefix “mydata.” before the Field name, e.g. “mydata.Name_Of_Field” – this will give you the stored value for “Name_Of_Field“.

There is a trick to this – the system needs to have actually created a datafile before this command will work. Otherwise it will throw an error. If you have only loaded one page of your Multi-form when you first try and access the datafile, no file will have been created. So to avoid an error, you first need to check if a datafile exits. You do this by putting an IF statement around the function like this:

If (mydata) {

   mydata.Name_Of_Field etc


If the datafile exits, then the value of the Field will be accessed, otherwise it will be passed over. You may want to include a default value for the Field in this case, i.e. by using a ELSE default:

if (mydata) {
   if ( mydata.Name_Of_Field == 'true') {

else {