Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
There's some help with relations in Help.
"This is why it seems like some of your statements work and some do not. This is a common issue for people. Programmers learn to think through such strange logic and become comfortable understanding how to manipulate it. But this can be a sticking point for people unfamiliar with programming logic"
It would be less a problem if PTC provided Switch/Case or cascaded IF/ELSEIF/ELSE/ENDIF structures.
The cascade can be simulated using nested IF/ELSE/ENDIF as below from http://www.mcadcentral.com/creo-modeling/20554-proe-if-statements-w-string-params.html It allows the use of ELSE without non-obvious side-effects.
if search(DESCP , "LH") >0
Z = (W/2) - (.744/2) - .015
if search(DESCP , "RH") >0
Z = (W/2) + (.744/2) - .015
ELSE
Z = W/2
ENDIF
ENDIF
Alternatively, the structure below, redundant in the report qty case, can make for more capable relations, obviously only changing the value for num once, but controlling secondary variables based on it.
num="
mult=1
if asm_mbr_partnumber =="85085K4" & num=="
num = "AR"
endif
if asm_mbr_partnumber =="XYZ123" & num=="
mult=2
endif
if num == "
num = rpt_qty * mult
endif
x
Well, there was no additional whitespace kept by the editor, but the comment does reinforce my assertion that PTC needs to add a Switch/Case, without drop-throughor IF/ELSE IF/ELSE/ENDIF cascade.
Properly written with the stone knives and bearskins available ("."s to keep editor from eating white space):
IF search(DESCP , "LH") >0
Z = (W/2) - (.744/2) - .015
ELSE
.....IF search(DESCP , "RH") >0
.....Z = (W/2) + (.744/2) - .015
.....ELSE
.....Z = W/2
.....ENDIF
ENDIF
What it could look like with decent structure:
IF search(DESCP , "LH") > 0THENZ = (W/2) - (.744/2) - .015
ELSE IF search(DESCP , "RH")> 0 THEN Z = (W/2) + (.744/2) - .015
ELSE Z = W/2
END IF
x
My money is always on those who, like Terry, can and do ask good questions when there is something going wrong. That's the best kind of employee.
In Reply to Jonathan Hodgson:
I think the clue is in "people _given_ admin responsibilities":
"Hey you, you're good at using Pro/E - you can be the admin."
See also: Peter Principle (and possible Dilbert Principle).
Jonathan
x