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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Repeat Region Relation Blanking Other Cells

kspabs
7-Bedrock

Repeat Region Relation Blanking Other Cells

This is reference to the previous thread that helped me solve with I was trying to do at the time, but am now having issues with: https://community.ptc.com/t5/3D-Part-Assembly-Design/Hiding-specified-value-in-a-BOM/m-p/730146#M119621

 

I'm using the following relation:

IF asm_mbr_cagecode == "2233"
my_cagecode = " "
ELSE
my_cagecode = asm_mbr_cagecode
ENDIF

and have &rpt.rel.my_cagecode in the table column.

 

I have also added a relation to display the quanities of bulk items as AR (as required) using the following:

IF asm_mbr_type == "BULK ITEM"
qty = "AR"
ELSE
qty = rpt_qty
ENDIF

while changing the QTY column to &rpt.rel.qty.

 

When I have both sets of code in my relations, nearly all of the quantities update as they should but a handful of them will have blanked quantities and cage codes now. If I remove the first relation for the cage code then it fixes all of the broken quantities. For some reason the two relations are conflicting with each other it seems. And this issue is only happening to certain pieces of hardware that happen to have family tables my Configuration Management team has established in PDM.

ACCEPTED SOLUTION

Accepted Solutions
mburlone
10-Marble
(To:kspabs)

Weird behavior occurs if the parameter that the IF statement is looking for does not exist on one or more of the items in the repeat region.

 

Say for example that you imported a part from another organization that does not assign cagecode or type parameters to their .prt files.  When your repeat region looks for those parameters in the part and doesn't find them, it causes unusual behavior.

View solution in original post

9 REPLIES 9
Dale_Rosema
23-Emerald III
(To:kspabs)

Have you tried a nested loop.

 

 

This is one that I developed for "half" quantity of parts
:

 

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

 

IF asm_mbr_pn == "9117"

 

  NEWQTY = "0.5"

 

ELSE

 

IF asm_mbr_pn == "9158"

 

  NEWQTY = "0.5"

 

ELSE

 

IF asm_mbr_pn == "9165"

 

  NEWQTY = "0.5"

 

ELSE

 

IF asm_mbr_pn == "9588"

 

  NEWQTY = "0.5"

 

ELSE

 

IF asm_mbr_pn == "9587"

 

  NEWQTY = "1"

 

ELSE

 

  NEWQTY = rpt_qty

 

ENDIF

 

ENDIF

 

ENDIF

 

ENDIF

 

ENDIF

 

ENDIF

 

ENDIF

 

ENDIF

 

ENDIF

Yikes! 😉

 

I would start with an EXISTS function, to check if the required parameter is present, and I would also use the OR operator (|) to check multiple conditions...

 

It's also much easier to expand this code 🙂

 

 

 

IF EXISTS("asm_mbr_pn")
   IF \
      asm_mbr_pn == "9594" | \
      asm_mbr_pn == "9556" | \
      asm_mbr_pn == "9151" | \
      asm_mbr_pn == "9117" | \
      asm_mbr_pn == "9158" | \
      asm_mbr_pn == "9165" | \
      asm_mbr_pn == "9588"
         NEWQTY = "0.5"
   ELSE
      IF \
         asm_mbr_pn == "9587"
            NEWQTY = "1"
      ELSE
         NEWQTY = rpt_qty
      ENDIF
   ENDIF
ELSE
   NEWQTY = rpt_qty
ENDIF

 

 

 

Chris3
21-Topaz I
(To:kspabs)

Cage codes are more than 4 characters long. Are you using extract by any chance?

 

If so the problem is likely that there is a NULL response when trying to extract 4 characters from a string that has less than 4 characters. Creo returns this NULL as a blank response.

 

To get around this you check the string length first before using the extract function. IE:

 

if string_length(extract_parameter)>3
parameter = extract(extract_parameter,1,4)
endif
kspabs
7-Bedrock
(To:Chris3)

I should have realized that my placeholder cagecode I used in my example was only 4 digits.. all of the cagecodes in my BOM are 5 digits and my actual relation represents that.

 

I am now looking through and noticing that the parts in my BOM experiencing these issues don't have a 'CAGECODE' parameter. How can I deal with this in my relation? Some of these parts (hardware primarily) I don't have the privilege to modify and add a parameter.

TomU
23-Emerald IV
(To:kspabs)

As others sort of alluded to, if there is any error in the relations evaluation for that one row, you will get an empty cell.  Essentially the entire relations statement is independently evaluated for each row of the table.

kspabs
7-Bedrock
(To:TomU)

I just noticed that these issues are a result of the parameter missing from these parts entirely. What can I include in my relation to avoid this?

mburlone
10-Marble
(To:kspabs)

Weird behavior occurs if the parameter that the IF statement is looking for does not exist on one or more of the items in the repeat region.

 

Say for example that you imported a part from another organization that does not assign cagecode or type parameters to their .prt files.  When your repeat region looks for those parameters in the part and doesn't find them, it causes unusual behavior.

kspabs
7-Bedrock
(To:mburlone)

This was exactly the issue, and I was able to come up with the solution on my own:

 

IF exists("asm_mbr_cagecode") 
	IF asm_mbr_cagecode == "12345"
	my_cagecode = " "
	ELSE
	my_cagecode = asm_mbr_cagecode
	ENDIF
ENDIF

That's the solution I posted 5 days ago...I'm glad you figured it out yourself as well 😊

Announcements
NEW Creo+ Topics: Real-time Collaboration


Top Tags