Skip to main content
1-Visitor
May 1, 2015
Solved

Relations (Else If) in Repeat Region

  • May 1, 2015
  • 2 replies
  • 12422 views

Hello,

I am able to set relations in repeat region as below:

if asm_mbr_name == "PRT0001"

CAD_SAP_PLM_IDX = "1000"

else

CAD_SAP_PLM_IDX = RPT_INDEX

endif

I would like to understand how to use else if into relation. My scenario is as below:

  • CAD_SAP_PLM_IDX = "1000" for "PRT0001"
  • CAD_SAP_PLM_IDX = "1001" for "PRT0002"
  • CAD_SAP_PLM_IDX = rpt.index for rest all parts

Thank you in advance.

Regards

Ketan


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
Best answer by Dale_Rosema

Remember that for every "if" you need and an "endif" at the end.

I have a word doc that I can cut and paste as needed (a sample of that file):

IF asm_mbr_pn == "9594"

NEWQTY = "0.5"

ELSE

IF asm_mbr_pn == "9556"

NEWQTY = "0.5"

ELSE

IF asm_mbr_pn == "9151"

NEWQTY = "0.5"

ELSE

ENDIF

ENDIF

ENDIF

2 replies

1-Visitor
May 1, 2015

By stacking up all the ifs. Each if statement has to end with an endif.

if asm_mbr_name == "PRT0001"

CAD_SAP_PLM_IDX = "1000"

else

if asm_mbr_name == "PRT0002"

CAD_SAP_PLM_IDX = "1001"

else

if asm_mbr_name == "PRT0003"

CAD_SAP_PLM_IDX = "1002"

else

CAD_SAP_PLM_IDX = RPT_INDEX

endif

endif

endif

Dale_Rosema
23-Emerald III
23-Emerald III
May 1, 2015

Remember that for every "if" you need and an "endif" at the end.

I have a word doc that I can cut and paste as needed (a sample of that file):

IF asm_mbr_pn == "9594"

NEWQTY = "0.5"

ELSE

IF asm_mbr_pn == "9556"

NEWQTY = "0.5"

ELSE

IF asm_mbr_pn == "9151"

NEWQTY = "0.5"

ELSE

ENDIF

ENDIF

ENDIF

23-Emerald IV
May 1, 2015

To summarize, there is no built in "ELSE IF" in Creo. You can get the same effect by using "ELSE", then another "IF", then another "ELSE" and so on, but deeply nested "IF" and "ELSE" statements can get tough to follow.

For repeat region relations I prefer to set the default value and then check for the other conditions. (The last one set "wins".)

CAD_SAP_PLM_IDX = RPT_INDEX

IF ASM_MBR_NAME == "PRT0001"

CAD_SAP_PLM_IDX = "1000"

ENDIF

IF ASM_MBR_NAME == "PRT0002"

CAD_SAP_PLM_IDX = "1001"

ENDIF

1-Visitor
May 2, 2015

Thank you all for help.