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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

IF statement for references

kgullner
1-Newbie

IF statement for references

Can i make a IF statement for my references? Say if true reference1 is active, and if false, reference2 is active.

If not, can i perhaps use VB for programming it?

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
-MFra-
21-Topaz II
(To:kgullner)


I think that it is impossible. All that you can do (Mathcad 15) is represented in the following  picture that I hope is understandable:

About references.jpg

In the worksheet A, you can add all the reference you want, you have to ensure that in each of them there are not the same references.

You can call functions and programs from user defined DDL added to mathcad.

View solution in original post

12 REPLIES 12
-MFra-
21-Topaz II
(To:kgullner)


I think that it is impossible. All that you can do (Mathcad 15) is represented in the following  picture that I hope is understandable:

About references.jpg

In the worksheet A, you can add all the reference you want, you have to ensure that in each of them there are not the same references.

You can call functions and programs from user defined DDL added to mathcad.

DJF
16-Pearl
16-Pearl
(To:kgullner)

I'm not really sure what you are after, but it sounds like a lookup table might work.  something like this:

lookup1.jpg

LucMeekes
23-Emerald III
(To:kgullner)

Mathcad does not support conditional references, nor does Prime.

What version of Mathcad (or Prime) do you (want to) use?

Depending on what kind of information you wanted to put in the alternative references, there may be better ways.

Luc

Hi, thanks for all answers.

The version is Mathcad 15. I am trying to isolate different calculations. For example: I know how to calculate crack width for concrete. I also know how to calculate the number of reinfocement bars for concrete, depending on moment and shear forces. But, i dont want to perform/have all calculations in one sheet. Instead i want to be able to call for the calculations. So the different calculations are modules in some way.

-MFra-
21-Topaz II
(To:kgullner)

Hi,

Create your worksheets independently of each other, and use the references in the main worksheet, observing my diagram provided earlier. You can not redefine programs, variables and constants defined in other worksheets that are part of  the references, you can only call them in the main worksheet. Otherwise you can expect freezing the computer.

LucMeekes
23-Emerald III
(To:-MFra-)

>Otherwise you can expect freezing the computer.

That only occurs when you make circular references.

You can see referencing a sheet as the referenced sheet being inserted at its referencing position inside the referencing sheet.

(That's a lot of 'reference' in one sentence.)

Example: It should be perfectly OK to define a variable X in sheets A, B and C. Then have a top sheet reference B, define X and then reference C and have sheet B reference A. Like this.

Sheet A:

Define X

Sheet B:

Define X

Ref A

Sheet C:

Define X

Sheet Top:

Ref B

Define X

Ref C

What you find for X in the Top sheet:

- Just above the reference to sheet B is X as undefined.

- Just above the definition of X is X as defined in sheet A (because in sheet B the definition by sheet A overrules the definition of X of sheet B itself).

- Below the reference to sheet C is X as defined in sheet C.

Luc

-MFra-
21-Topaz II
(To:LucMeekes)

The things I write are the result of practical experience, not suppositions.

LucMeekes
23-Emerald III
(To:-MFra-)

In this case, it's no different for me.

Fortunately I never had the experience of a crash due to nested references.

Luc

-MFra-
21-Topaz II
(To:LucMeekes)

... I know you're infallible ....

LucMeekes
23-Emerald III
(To:-MFra-)

No, but anyway, here's proof:

SheetTop:

Just place all four (attached) sheets in the same directory and open SheetTop.

Luc

-MFra-
21-Topaz II
(To:LucMeekes)

I have set always the references at the beginning of the worksheet and not where something from that particular reference is requested. This, to simplify the search in large worksheets (hundreds of pages). Perhaps this affects much of the rest of the main worksheet. I think that your example is not very useful.

LucMeekes
23-Emerald III
(To:-MFra-)

Not useful for you maybe, but for lack of a possibility to have 'a sheet as a function', and with reference to Multiple values for single variable‌:

I've used a sheet that calculates a set of data from a set of changing parameters, over and over again each time with the parameters different, and assembled the results in a single matrix.

This was done with a single top sheet, then setting the parameters for the first time, having the data calculated by a first reference to the calculating sheet (that had no definitions for the parameters, but simply used their values), then assembling the resulting data as a row vector.

Then set the parameters (different) for the second time, having the data calculated by referencing the same calculating sheet, then adding the results as another row to the first row vector. This over and over again, I got the results in a big matrix.

Very useful if you need it.

Luc

Top Tags