How to Know What Form Page is Active

HI,

I’m trying to show or hide Action Buttons depending on which form page is active.

Here is a screen shot of my SetupReports screen:


And here is the screenshot of same form with second page selected:

Please note I only captured the screenshot showing the first 4 items in the dataview.

Notice the All and None action buttons on form header. I’ve configured these buttons to only show if I’m viewing the subforms (hope terminology is right. I consider the pages other than General as subforms).

I don’t know the proper way to hide/show the action buttons depending on the active page, so I came up with “my” method. I wrote functions called SetSubformNameStudyGroups, SetSubformNamePortfolios, SetSubformNameMembers and SetsubformNameNone. Here is the code for these:

function SetSubformNameStudyGroups(five, context, result)  {
    five.setVariable('SubformName', 'StudyGroups');
    five.showMessage('SubformName: ' + five.variable.SubformName);
    return five.success(result);
}

The only difference between the 3 functions are the value of the variable, either StudyGroups, Portfolios or Members.

The final function, SetSubformNameNone contains this:

function SetSubformNameNone(five, context, result)  {
    five.clearVariable('SubformName');
    five.showMessage('SubformName: ' + five.variable.SubformName);
    return five.success(result);
}

The General events page looks like this:


The StudyGroups events page looks like this:

The other pages look like this page, except for the name of the On Selected function. This all seems to work, and the variables are set properly.

So here is the question: Am I doing this properly, or is there a better way to hide/show these action buttons? I can’t find anything anywhere in the inspector that identifies which page is active.

The way I’m doing this seems quite roundabout. Is there something simpler that I don’t know about?

Also, am I mis-understanding the meaning of subform? Can’t seem to find a definition of that in the docs.

Thanks…

Any idea on this topic? it’s been 3 weeks…

Hello,

The method you are currently using works great!

I would do the same. Also a subform is essentially a form within another form.

Thanks,
Riley.

thanks so much Riley. I’m used to using form pages, but not subforms. can you please supply a use-case on how you would use subforms, and/or point me to the correct documentation for them?

Hello,

An example use case for a sub form would be if you have one table, Users, and another table, UserEnquiries, where the UserEnquiries table holds information about enquiries made by users and is linked to the Users table by a foreign key. You could then display the Users form, and have a subform within the Users form which displays the enquiries created by that user.

To create a subform, you essentially create two different forms, then, within one of the forms, create a second page, select the Page Type to be ‘List’, then for the action, select the other form you created. If there is a foreign key relationship between the two forms, the subform will automatically filter depending on which record is selected within the parent form.

Thanks,
Riley.