cancel
Showing results for 
Search instead for 
Did you mean: 

Test_when function not working as desired

Former Member
0 Kudos

Hi Experts,

We are using the Test_when command in our script logic to run a set of commands based on some condition. The intention is that a when loop be entered into only when there is some value in a particular account at a specified intersection. We are retrieving the value from the account using the Get function and using the same for comparison in the Test_when command. The syntax used is as below:

*TEST_WHEN(GET(AccountL="9000045",DATASRC="AJ_RETEARN",IntCol="I_None",GROUPS="C_10001",CATEGORY="ACTUAL",ACCTDETAIL="F_NONE")<>0))

*WHEN u2026

u2026.

*ENDWHEN

We have checked the get function and it returns a value for the account. But the Test_When function is not working properly.

Are we missing something here?

Any suggestion would be greatly helpful.

Regards,

Rajit

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

At the first you have 2 "(" but in the end you have 3 ")", is that something missing about your script there.. if not it might your problem..

hope helps

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Rajit,

The TEST_WHEN condition needs to have condition. I cant see the condition in your example

*TEST_WHEN(GET(AccountL="9000045",DATASRC="AJ_RETEARN",IntCol="I_None",GROUPS="C_10001",CATEGORY="ACTUAL",
ACCTDETAIL="F_NONE") = 0)

*WHEN u2026
u2026.
*ENDWHEN

So, please maintain a conditional operator in your statement.

Hope that helps.

Former Member
0 Kudos

Hi,

Thanks to both of you for your replies.

I have removed one of the brackets but it is still not working.


*TEST_WHEN(GET(AccountL="9000045",DATASRC="AJ_RETEARN",IntCol="I_None",GROUPS="C_10001",CATEGORY="ACTUAL",
ACCTDETAIL="F_NONE") <> 0)   (not equal to sign put does not get dispayed on SDN)

*WHEN u2026
u2026.
*ENDWHEN

Any further inputs would be helpful.

Regards,

Rajit

Former Member
0 Kudos

Hi Rajit,

What value do you have in the SQL table for the intersection mentioned in the TEST_WHEN condition?

Former Member
0 Kudos

Hi Nilanjan,

The value at the mentioned intersection is -1912347.696. The account is of Income type.

Regards,

Rajit

Former Member
0 Kudos

Hi Rajit,

I would requst you to share the LGF and the LGX file of your script. It will help us to analyze what exactly is going wrong.

Former Member
0 Kudos

Hi,

Please find below the extracts of the LGF and the LGX files of the script.


==============Legal COnsol LGF================================

*XDIM_MEMBERSET CATEGORY = ACTUAL
*XDIM_MEMBERSET ACCTDETAIL=F_NONE
*XDIM_MEMBERSET DATASRC=AJ_RETEARN
*XDIM_MEMBERSET LegalEntity = 6700,7000,7200,7700,7800,7100
*XDIM_MEMBERSET ACCOUNTL = 9000001O,9000044,9000045,9000046
*XDIM_MEMBERSET GROUPS = C_10001
*XDIM_MEMBERSET IntCol=I_None


*TEST_WHEN((GET(AccountL="9000045",DATASRC="AJ_RETEARN",IntCol="I_None",GROUPS="C_10001",CATEGORY="ACTUAL",ACCTDETAIL="F_NONE")<>0))

 *WHEN LegalEntity
 *IS *
 
   *WHEN ACCOUNTL
   *IS 9000044
   *REC(FACTOR=1,ACCOUNTL="9000046",DATASRC="AJ_RETEARN")
    *ENDWHEN
  *WHEN ACCOUNTL
   *IS 9000001O
   *REC(FACTOR=-1,ACCOUNTL="9000046",DATASRC="AJ_RETEARN")

  *ENDWHEN
*ENDWHEN

*COMMIT





==============Legal COnsol LGX================================

*XDIM_MEMBERSET CATEGORY = ACTUAL
*XDIM_MEMBERSET ACCTDETAIL=F_NONE
*XDIM_MEMBERSET DATASRC=AJ_RETEARN
*XDIM_MEMBERSET LEGALENTITY = 6700,7000,7200,7700,7800,7100
*XDIM_MEMBERSET ACCOUNTL = 9000001O,9000044,9000045,9000046
*XDIM_MEMBERSET GROUPS = C_10001
*XDIM_MEMBERSET INTCOL=I_NONE
*TEST_WHEN((GET(ACCOUNTL="9000045",DATASRC="AJ_RETEARN",INTCOL="I_NONE",GROUPS="C_10001",CATEGORY="ACTUAL",ACCTDETAIL="F_NONE")<>0))
*WHEN LEGALENTITY
*IS *
*WHEN ACCOUNTL
*IS 9000044
*REC(FACTOR=1,ACCOUNTL="9000046",DATASRC="AJ_RETEARN")
*ENDWHEN
*WHEN ACCOUNTL
*IS 9000001O
*REC(FACTOR=-1,ACCOUNTL="9000046",DATASRC="AJ_RETEARN")
*ENDWHEN
*ENDWHEN

*COMMIT

Thanks in advance.

Regards,

Rajit

Former Member
0 Kudos

The *TEST_WHEN is looking at the intersection:

AccountL="9000045"

DATASRC="AJ_RETEARN"

IntCol="I_None"

GROUPS="C_10001"

CATEGORY="ACTUAL"

ACCTDETAIL="F_NONE"

All other dimensions will be based on the first record of the recordset being acted upon (the first query in the logic debug). In this case it could be any legal entity in (6700,7000,7200,7700,7800,7100). The value in previous posts was for what legal entity and are any of those legal entities 0 for the intersection and is this the legal entity in the first row of the record set? You have to specify all dimensions for *GET() that could be varying in the memberset for a *TEST_WHEN condition.

You could use a Lookup to get the value and then compare it in a *WHEN condition. This is not ideal, because it will do the look up for each record but unless you have many dimensions not specified here then it should be alright.

The other option is to put this in a for loop and run the logic with the test when condition for each legal entity.

Former Member
0 Kudos

Thanks Graham,

Will try the for - next option and get back with the status.

Regards,

Rajit