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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Different set of calculations based on option selected

ojoshi-2
3-Visitor

Different set of calculations based on option selected

We use Mathcad for calculations of structural design and create a report of it to be submitted to the customers. While I have created a Mathcad file having set of calculations for standard product, there is a slightly different variant of that product that requires slightly different calculations to be incorporated than the standard one. Now, I want to standardise the template of the report such that, there will be two options (Radio buttons etc) in the beginning to select the variant, and based on the selection the set of calculations will be displayed. Thus I don't have to create two different types of template for the same product.

The way of doint it can be hiding and unhiding corresponding regions/pages based on the selection of variant but I don't know how to do it.

Any thoughts?

5 REPLIES 5

I don't know anything about MC 15 but in MCPrime 3.1 this will most probably not be possible.

You could use if clauses in all calculations but you can't open or close regions programatically.

Perhaps the much hailed new api is able to control regions, but you'd pay a shit-load of money to find that out (and i personally doubt it is possible).

MJG
18-Opal
18-Opal
(To:ojoshi-2)

Hidden regions are available in MC15 (& prior), but I don't know how they can be controlled programmatically.

Additionally, however, please note that although the regions are hidden, the calculations are still active.  If you define Z in an equation for your first option, but define it differently in a subsequent hidden region for your second option, the value of Z will be based on the hidden calculation.  You could possibly work something out to define them as Z1 & Z2, and then have an equation after both sections that defines Z as either Z1 or Z2 (based on the chosen option), that way the rest of the worksheet can reference the correct value of Z.

Personally, I just have two worksheets that are mostly identical except for the variation.  This works for me because I don't need to switch between the two variations (I know at the beginning of the project which option I'll use).  The downside, however, is that if I want to change something in the template, I have to change it in both templates.

RichardJ
19-Tanzanite
(To:ojoshi-2)

In Mathcad 15 you could do what you want by changing the XML of a math region via the automation interface (basically, rewrite the XML from within a scripted component, such as  a radio button). I have no idea if this is possible in Prime, and have no intention of paying PTCs extortionate price to find out.

LucMeekes
23-Emerald III
(To:ojoshi-2)

Would this help?

(You could hide the definition of f(x) in a collapsed area, or on a right-side page.)

Now if you change the value of Switch and recalculate:

Success!
Luc

StuartBruff
23-Emerald II
(To:ojoshi-2)

Omkar Joshi wrote:

We use Mathcad for calculations of structural design and create a report of it to be submitted to the customers. While I have created a Mathcad file having set of calculations for standard product, there is a slightly different variant of that product that requires slightly different calculations to be incorporated than the standard one. Now, I want to standardise the template of the report such that, there will be two options (Radio buttons etc) in the beginning to select the variant, and based on the selection the set of calculations will be displayed. Thus I don't have to create two different types of template for the same product.

The way of doint it can be hiding and unhiding corresponding regions/pages based on the selection of variant but I don't know how to do it.

Any thoughts?

Put the separate calculations into separate (collapsed) Areas and delete the one you don't want.

Stuart

Top Tags