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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Translate the entire conversation x

Variable access in included (reference) sheet

GR_13078482
2-Explorer

Variable access in included (reference) sheet

I am using an include statement to include calculations and values from a reference sheet in my main Mathcad document.

 

Is there a way to get access to variables defined in the parent document in the reference document? For example, if I define a variable called "mass" in the parent document, and then I have an expression in the referenced document that multiplies mass by 2, as in: double_mass := mass * 2, will that work? 

 

Right now, I am only able to use variables in the reference sheet that have been defined in that sheet. I do note that functions and variables defined in the reference sheet are available in the parent sheet following the include statement, as expected.

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:GR_13078482)

The worksheet you include can use all variables from the parents sheet which are defined in front of the "Include" region.

But when you edit the include sheet, these variables will be unknown and so you will see an error message. Nonetheless the combination from parent sheet and included sheet will work OK.

Example;

Included sheet (Incl.mcdx) contains

Werner_E_0-1743512047494.png

It throws an error as of x not being defined.

The parents sheet works OK, though:

Werner_E_1-1743512173074.png

 

An included worksheet acts as if the containing commands would be written in the parents sheet at the position of the "Include".

 

 

 

 

View solution in original post

1 REPLY 1
Werner_E
25-Diamond I
(To:GR_13078482)

The worksheet you include can use all variables from the parents sheet which are defined in front of the "Include" region.

But when you edit the include sheet, these variables will be unknown and so you will see an error message. Nonetheless the combination from parent sheet and included sheet will work OK.

Example;

Included sheet (Incl.mcdx) contains

Werner_E_0-1743512047494.png

It throws an error as of x not being defined.

The parents sheet works OK, though:

Werner_E_1-1743512173074.png

 

An included worksheet acts as if the containing commands would be written in the parents sheet at the position of the "Include".

 

 

 

 

Announcements


Top Tags