Expand my Community achievements bar.

Script to select a different Master Page?

Avatar

Level 1

Hi,

I'm working on a form that is used to document physical therapy sessions. The user will enter in an Annual Goal at the top of the first page, and then some Short Term Objectives (STOs). STOs are the specific activities the patient is working on. There will be at least 2 STOs, but the user can add more (sfmSTO).

The user will then use a Note subform (sfmNote) to document what treatment was provided during each therapy session. sfmNote can flow onto subsequent pages.

Users have requested that the STOs be placed at the top of each subsequent page so that they don't have to scroll back to the first page to look at the STOs. Originally, I was hoping to use sfmSTO as an overflow leader. However, it appears that because sfmSTO has a table, it can't be used as an overflow leader. [I asked a previous question about it here.]

My new idea is to have the data from sfmSTO on the first page get copied to a subform (sfmMaster2STO) that is placed at the top of a second Master page. This works.

My problem is that if the user adds a 3rd row to sfmSTO on the first page, I can't dynamically add an additional row to sfmMaster2STO on the 2nd Master page.

So...I've created a 3rd Master page that allows extra space to accommodate an additional STO. It has a subform that has 3 rows in it (sfmMaster3STO).

My question is:

Can I use a script to determine how many rows are in sfmSTO on the first page, and then have the proper Master Page be selected for subsequent pages? (i.e., if there are only 2 STOs, use Master Page2; if there are 3 STOs, use Master Page3)

I assume that the script would change the behavior of sfmNote > Object > Pagination > If Dataset Must Be Paginated: Overflow.

The form can be accessed here.

Thanks for any suggestions you have!

Ray

1 Reply

Avatar

Level 1

From my continued reading, it appears that what I wanted to do is not possible.

I ended up making a design choice of having a 4 row table on the second Master page. The user's data from sfmSTO will copy to the second (and subsequent pages). If the user only chooses to create 2 STOs, there will still be 2 empty rows on the second page. If the user chooses to create more than 4 STOs, only the first 4 of them will be displayed on pages 2+. Not ideal, but certainly workable.