Skip to main content
Jul 19, 2021 7:17 PM UTC
Solved

Repeat Region Relation and Cagec issue

I have the following relation in my relations for a BOM that simply removes the specified cage code:

 

 

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

 

 

 Which has worked as intended, EXCEPT I am now noticing that there are a few parts in my BOM that are pulling the incorrect cage code from another unrelated part. Without the relation, I don't have this issue. Not sure where this issues may be coming from.

TomUAnswer
Jul 19, 2021 7:29 PM UTC

Makes sense.  "my_cagecode" is a repeat region level parameter and it's value is static unless something changes it.  When "asm_mbr_cagecode" doesn't exist, there is nothing to change "my_cagecode" to some other value.  You need to either pre-initialize "my_cagecode" or add an extra ELSE statement.

 

my_cagecode = " "

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

2 replies

TomUAnswer
Jul 19, 2021 7:29 PM UTC

Makes sense.  "my_cagecode" is a repeat region level parameter and it's value is static unless something changes it.  When "asm_mbr_cagecode" doesn't exist, there is nothing to change "my_cagecode" to some other value.  You need to either pre-initialize "my_cagecode" or add an extra ELSE statement.

 

my_cagecode = " "

IF exists("asm_mbr_cagecode") 
 IF asm_mbr_cagecode == "12345"
	 my_cagecode = " "
 ELSE
	 my_cagecode = asm_mbr_cagecode
 ENDIF
ELSE
 my_cagecode = " "
ENDIF
kspabsAuthor
Jul 19, 2021 8:42 PM UTC

Awesome, this fixed it exactly and makes sense why I was seeing this behavior. Thank you!