×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Multiple "IFs" in one expression

Multiple "IFs" in one expression

Multiple "IFs" in one expression

(OP)
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!

RE: Multiple "IFs" in one expression

(OP)
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)

RE: Multiple "IFs" in one expression

I don't think you should be putting A, B, & C in quotes

RE: Multiple "IFs" in one expression

(OP)
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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources