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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

How do i write relation

John.Pryal
14-Alexandrite

How do i write relation

Hi all,

i am trying to figure out (without success) how to write a relation. I want to control a diameter when another diameter is a given value. For example, if diameter A = 100 then diameter B = 120. I thought the following would work, but it does not, i get error in relations.

IF A=100

THEN B =120

ENDIF

Regards

John

5 REPLIES 5

Hi John,

try this one:

if (A==100)

B=120

else

B=100

endif

Regards

Oli

Oliver Gräbner
B&W Software GmbH

Hi Oliver,

thank you for the reply, that worked, sort of. I actually want to add more than one relation, so when A=100, B=120, but i also want when A=110, B=120 & A=120, B=130.

These are not the actual values i require, i have used them for simplicity, the actual figures do increase by 10 each time, they are more random.

Regards

John

John.Pryal
14-Alexandrite
(To:John.Pryal)

Ok, i figured it out. I dropped the last 2 lines, ELSE & B=100. Now things are working in exactly the way i wanted. Thank you for pointing me in the right direction Oliver.

Kind Regards

John

John,

I assume you picked up the subtle syntax distinction relative to your initial post. When using a conditional statement line (like IF), "equals" is rendered ==; when setting something to a value, "equals" is rendered by =.

Since you have more than 2 states, as you have discovered, you want multiple IF..ENDIF sections, rather than one IF...ELSE...ENDIF section.

David

Kevin
12-Amethyst
(To:John.Pryal)

Your relations could also have the form:

IF A==...

B=...

ELSE

IF A==...

B=...

ELSE

IF A==...

B=...

ELSE

.

.

.

ELSE

B=...

ENDIF

ENDIF

ENDIF

.

.

.

Announcements
Business Continuity with Creo: Learn more about it here.

Top Tags