Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to create arraylist or lookup table and use it in tJavaRow

I have two xlsx file one is having Raw data and another one is lookup table or keywords. I written java code to match the string of raw data with keywords.

 

How to create the arraylist of lookup table and use the arraylist in tJavaRow at the time of raw data processing. As i mentioned i have the string matching java code which is working fine just need to pass the two inputs one is arraylist and raw data row by row records.

 

tJavaRow takes only one input.

Labels (2)
7 Replies
Anonymous
Not applicable
Author

Hello,

We will appreciate it a lot if you could elaborate your case with an example with input and expected output values.

Best regards

Sabrina

 

rmartin2
Creator II
Creator II

Hello !

 

Not sure to understand quite well what you're trying to do, but, you could put your lookup your ArrayList in globalMap and use it inside the tJaravaRow.

It will just just set a reference, and not the whole object, so you will retrieve the data every single row.

 

Can you put a screen/job of what you are doing ?

 

 

Sincerely,

Anonymous
Not applicable
Author

rmartin,

 

For reference i would like showcase my job as, i am using tIntervalMatch or tFuzzyMatch.here insted of these logic i would like use my string match java code. 

 

0683p000009M6oH.pngat marked area i want my java logic should be placed. either in tJavaRow or some other way

I would like to use tJavaRow in the highlighted area, but tJavaRow takes only one input then how should i use the lookup table value. I can try  globalMap but as day passes my lookup sheet also gets updated, globalMap is going to work with it.

rmartin2
Creator II
Creator II

Here's the job :
0683p000009M6jd.jpg

 

 

 

 

 

 

 

 

 

 

 

In the first tJavaRow, you build 2 things : your validator, which is a simple foreach Java code in a routine, and for each line, the matching rule.

The validator is holding all rules and is put in GlobalMap :

 

0683p000009M6cn.jpg

 

Then just have to apply it on each row of your Input XLSX :

 

0683p000009M6oW.jpg

 

I'm using this kind of things to create a "BusinessRule checker", which is what you're kinda trying to do here.

 

Does it match what you're looking for ?

The Validator is made to check all rules and ask each rule : "is it valid ?".

So your "Java code" you already have goes to the "Matching rule" object.

 

Anonymous
Not applicable
Author

Hi rmartin,

 

Will implement your suggested way and let you know the result in 1 day. 

Anonymous
Not applicable
Author

Hi All,

 

Thank you for your help, with your suggestions I am able to solve the problem.

 

I am attaching the screenshots of my job.

 

Screen 1- lookup sheet is red then created the HashMap and stored in globalMap.

Screen 2 - tJavaFlex_1 making HashMap.

then i read raw data pass through the tJavaRow_2 there my wild string matching algorithm is written. It's working as per my requirement.

 

Let me know if it can be done in better way.

 

0683p000009M6gJ.png0683p000009M6rB.png

rmartin2
Creator II
Creator II

Quick suggestion :
Don't use tJavaFlex but TjavaRow : I think working with a separate tJava (where you put in global var your hashMap) in a previous stage is better, an then you only have to focus on dealing with your rows. You don't have to put back the HashMap in the globalMap (I think... normally) But it's only my opinion 0683p000009MA9p.png

Another one, this one, kina mandatory : don"t use "On componentOK" on your ending component but use "On Subjob ok", because if you have multiple file, you will start many times your "Master Data Template work", which you don't want to see happening.
If you want it to happen, don't use "OnComponentOk", but use a second step to the iteration process. It offers better control.