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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

12-Amethyst

## 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
16-Pearl
(To:John.Pryal)

Hi John,

try this one:

if (A==100)

B=120

else

B=100

endif

Regards

Oli

Oliver Gräbner
B&W Software GmbH
12-Amethyst
(To:OliverGräbner)

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

12-Amethyst
(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

1-Newbie
(To:John.Pryal)

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

10-Marble
(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