cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Script logic

Former Member
0 Kudos

Hello friends,

Here is the issue I am having with script logic:

I have a script logic that basically flags #ABC=1 for all records followed by GO. Here it is:

*WHEN DATASRC

*IS PCA

*REC(EXPRESSION=1,DATASRC=#ABC)

*ENDWHEN

*GO

Now, if account=123, it should clear this flag. Here is the script:

*WHEN ACCOUNT

*IS 123

*WHEN DATASRC

*IS #ABC

*REC(FACTOR=0)

*ENDWHEN

*ENDWHEN

*GO

Now for all records that doesnt have #ABC=0, I want to clear them.

*WHEN DATASRC

*IS #ABC

*REC(FACTOR=0,DATASRC=PCA)

*ENDWHEN

*COMMIT

The problem is this script also removes Account=123 records as well. Where as it shouldnt. because the Account=123 records' #ABC flag was cleared beforehand. Please note that my code is far more complex than this, but this was easier to explain.

Please advise.

Accepted Solutions (1)

Accepted Solutions (1)

krishna_priya1
Contributor
0 Kudos

You can combine 2 ed & 3 rd sections as below.


*WHEN DATASRC
*IS #ABC

*WHEN ACCOUNT
*IS 123
*REC(EXPRESSION=1)
*ELSE
*REC(FACTOR=0)
*ENDWHEN

*ENDWHEN

*GO

Hope this helps.

Former Member
0 Kudos

Krishna,

Thanks for your response But I cant combine code blocks 2 & 3. the code is not this simple, i was just using this as an example.

JohnL
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Zalak,

Based on your requirement ("Now for all records that doesn't have #ABC=0, I want to clear them."), this code below:

*WHEN GET(DATASRC="#ABC")
*IS (less than and greater than signs) 0
*REC(FACTOR=0,DATASRC=PCA)
*ENDWHEN
*COMMIT

Or this code may work:

*WHEN DATASRC
*IS #ABC
*WHEN SIGNEDDATA
*IS (less than and greater than signs) 0
*REC(FACTOR=0,DATASRC=PCA)
*ENDWHEN
*ENDWHEN
*COMMIT

Give that a try and let us know how it goes.

Thanks,

John

Former Member
0 Kudos

John, that worked!!! You need a raise!

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

With the limited information, if you dont want the account 123 in the last section of the code, then you should have:

*WHEN ACCOUNT
* IS <> 123

Please note that there is a not equal to sign between IS and 123.

Hope this helps.

Just out of curiosity, even if the last section clears the flag again, is there any problem. Technically, it doesnt have any impact. The record is going to remain 0, after the last section.

Former Member
0 Kudos

Nilanjan, to your first point about having

WHEN ACCOUNT

IS (not equal to 123),

I cant do that. The code is not that simple. This was just a simple example I was using to explain the issue. so I cant combine like that.

Your second point("Just out of curiosity")-If you follow the code closely, the last section is not clearing the flag, its actually clearing the PCA Datasrc records that have the flag record(#ABC datasrc, signeddata=1) for the same intersection.

so basically the ultimate outcome should be: Clear all pca datasrc records that have a flag record(similiar dimension values except datasrc=#ABC, and signeddata of 1). In this example- all the accountIDs except AccountID 123 will have the flag record attached to them.