Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations JAE on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple "IFs" in one expression

Status
Not open for further replies.

jpate92

Automotive
Joined
Sep 11, 2013
Messages
20
Location
US
Hey All,

I am trying to figure out how/if to use multiple IFs within one IF-THEN-ELSE expression

Something along these lines:

IF(P1=A)(1.5);(P1=B)(2.5);(P1=C)(3.5)

I am not sure if this is possible and if it is I am having some trouble with the syntax(yes, i understand that the syntax above is incorrect)

I am looking to leverage this into some PTS functionality.

Any help would be great!

Thanks!
 
I seem to have a talent for answering my own questions ten minutes after I post them.

The syntax for a multiple IF expression is as follows:

if(P1=="A")(3.9)else if(P1=="B")(2.5)else if(P1=="C")(1.1)else(4)
 
I don't think you should be putting A, B, & C in quotes
 
Since the referenced expression (P1 in the reference) is a string input I have to enter the A,B and C entries as "A","B" or "C" or NX wants to look for an expression. It wants the same thing if I enter it as A instead of "A" in the IF-THEN-ELSE expression. If I enter just A I get an error telling me there is no expression A

The syntax I showed above works just as I wanted.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top