Skip to Content
0

variable in script logic to read property into another variable

Dec 23, 2017 at 04:59 PM

58

avatar image
Former Member

Hi,

I've created property PARENT to dimension ENTITY and trying to read Interco value of every entity's parent in scriptlogic but it's not working out with below code.I've googled forums for many threads but surprisingly i still can't get a solution hoping someone could guide me in right direction.

*XDIM_MEMBERSET ENTITY = BAS(G_A)
*XDIM_MEMBERSET ACCOUNT = CYNI
*FOR %ENT% = ENTITY
*WHEN INTERCO
*IS "NO_INTERCO"  
// Select Value from PARENT property of "ENTITY= %ENT%" to %PARENT% variable
*SELECT (%PARENT%, "[PARENT]", ENTITY, "[ID]='%ENT%'")  
// Select Value from INTCO property of "ENTITY=%PARENT%" to %INTCO% variable
*SELECT (%INTCO%, "[INTCO]", ENTITY, "[ID]='%PARENT%'")  
*REC(FACTOR=1 , INTERCO = %INTCO%)
//REC(FACTOR=1 , INTERCO = %PARENT%.INTCO)  // this also not working
//REC(FACTOR=1 , INTERCO = "I_" + %PARENT%)  // this also not working
*ENDWHEN
*NEXT

Here is the error i'm getting

UJK_VALIDATION_EXCEPTION:Member "" not exist

if i replace *REC(FACTOR=1 , INTERCO = %INTCO%) with *REC(FACTOR=1 , INTERCO = I_B) I'm getting records generated. So, looks like SELECT is not storing variables. How could i do this? I made sure that ENTITY has values for PARENT and INTCO properties as shown below.

1.png (8.7 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Vadim Kalinin Dec 24, 2017 at 03:49 PM
0

You need to understand some very basic things about script logic:

1. SELECT can't be used inside WHEN/ENDWHEN (and inside FOR/NEXT), it's executed only once at the beginning of script execution.

2. Instead of property PARENT create property PARENTINTCO and fill it with I_B for this sample.

Then:

*WHEN INTERCO
*IS "NO_INTERCO"
*REC(FACTOR=1 , INTERCO = ENTITY.PARENTINTCO)
*ENDWHEN

And remove FOR/NEXT loop for ENTITY - useless

No other way.

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks Vadim. I created the same way and got it working. Wanted to check if there is other way of achieving so asked.

0

There is now way to define destination member like:

DIMNAME1=DIMNAME2.PROPERTY1.PROPERTY2

0