cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Let slave sheet detect if master sheet present?

RenoFilla
1-Visitor

Let slave sheet detect if master sheet present?

Hi, I wonder if there is any method to let a (potentially) referenced sheet (potential slave) detect whether it has been called via reference by a master (which one) or if it is a master itself (i.e. run at top level)?

For me this is of interest as I have several nested MathCad sheets. Normally I will only open the most top level sheet (the master which references to all the sub sheets = slaves). However, sometimes I want to open a subscript directly and only execute the equations/programs defined there. Then, this sheet shall activate certain controls (checkboxes) which I use to define what method to use for calculation. However, if this sheet were to be referenced by a master, then I will have already set the checkboxes in the master, and then I do not want the slave sheet to alter the calculation setup.

In the beginning I thought it was as easy as defining a variable MASTER that I would set to some value in the most top level sheet, and the slave sheets then would just check if MASTER was already defined and if so, then they would not allow individual setup. However, MathCad rightly throws an "undefined variable" error when opening the slave sheet on its own, and refuses to process the equation checking the value of MASTER... Maybe there is any way around this?

But don't get hung up about this "undefined variable" issue, what I really need is described in the beginning, i.e. detecting run-time whether a sheet is referenced or top-level.

Cheers, Reno

ACCEPTED SOLUTION

Accepted Solutions

Try using the in0 to in9 variables. These are pre-initialised to zero, unless the sheet had them set by the calling programme.

So they are 'false' if the programme is standalone, and 'true' if you set them elsewhere (e.g. via API, or master sheet).

Check in the Authors Programming reference help.

Philip

View solution in original post

2 REPLIES 2

Try using the in0 to in9 variables. These are pre-initialised to zero, unless the sheet had them set by the calling programme.

So they are 'false' if the programme is standalone, and 'true' if you set them elsewhere (e.g. via API, or master sheet).

Check in the Authors Programming reference help.

Philip

Thank you Philip, this was exactly what I needed!

Announcements

Top Tags