Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
CFernandes1610115000
Contributor
Contributor

tMemorizeRow

Hi,

I have sorted my data based on a column called 'PolicyMembID'. I need to compare each consecutive row and if the value in the current row is different from the value in the previous row ,I mark it as "1" else it remains "0".(Both these columns have String data type)

I've used this expression after the tMemorize component :

row6.p1policymemberid.equals(((String[]) globalMap.get("tMemorizeRows_1_p1policymemberid"))[1]) ?

"0":"1" 

0693p00000BDxxOAAT.png

0693p00000BDxwfAAD.png

I am getting the below error.

"Exception in component tMap_11 (FlagUniques)

java.lang.ArrayIndexOutOfBoundsException: 1

at regeneron.flaguniques_0_1.FlagUniques.tFileInputDelimited_3Process(FlagUniques.java:7856)

at regeneron.flaguniques_0_1.FlagUniques.runJobInTOS(FlagUniques.java:8417)

at regeneron.flaguniques_0_1.FlagUniques.main(FlagUniques.java:8266)"

Please advise?

Labels (4)
2 Replies
David_Beaty
Specialist
Specialist

Hi

 

I think the problem you're having is that the first time through, there is no "previous" row to compare it to, and you are unsafely getting the memorized value and using array position 1.

 

Thanks

 

David

 

If these answers are useful, don't forget to give Kudos

CFernandes1610115000
Contributor
Contributor
Author

Yes, I found a workaround for this.

 

Instead of using the tMemorize component I used a tMap to create a new column having value of the previous row.I then compared the existing policymemberid column with the new column and marked it as 1 if the values were different and 0 if they were the same