Jump to content

If Then Else formulas in a characteristic


---
 Share

Recommended Posts

I am trying to get If/Then/Else statements to work in a result element characteristic. Specifically, I am wanting to look at a number derived from another characteristic and if it is negative add it to another number and if it is positive then subtract it from another number.

Is this possible without PCM?
Link to comment
Share on other sites

Please sign in to view this quote.

This Then/Else is not possible without PCM.

But you can use ORD statement. Basically you write both situations and use ORD with multiply to get result.
On monday i'll be at pc so i'll try to explain.

Ord converts from boolean to int - so something like this
First you get code to get TRUE or FALSE which ORD converts to ZERO or ONE which will be multiplied with calculation of returning number ( your needed result ). You write both conditions and calculations - then you sum up both results ( which one will be always ZERO )
ord(if( USER CONDITION POS ))*( USER CALCULATION POSITIVE ) + ord(if( USER CONDITION NEG ))*( USER CALCULATION NEGATIVE )
Link to comment
Share on other sites

Okay let me see if I understand this.

You have a condition(X<0) and if its true ORD will treat it as a 1
Then you have another condition(X>0) and if its true ORD will treat it as a 0

Then you have the final condition be something like: IF ORD = 1 THEN (X+Y) ELSE IF ORD = 0 then (X-Y).

Am I understanding that right?
Link to comment
Share on other sites

Please sign in to view this quote.

Hi,

a little functioning example:
I am not using IF, THEN, ELSE - just condition like this "A < B"
ord will change TRUE/FALSE to 1/0 so if you multiply real calculation with ord result - you will get 0 or correct calculation formula.
You write two formulas to cover both boolean states and sum up them ( whole formula work like this : 0 + correct or correct + 0 )

( ord(1<0) * (50+1) ) + ( ord(1>0) * (50-1) )
Link to comment
Share on other sites

  • 2 weeks later...
 Share

×
×
  • Create New...