Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Calling Globalvariable in Expression builder returns null

Hi,

I am passing my rows through tAggregateRow and getting the max value of a particular row and storing it in tSetGlobalVar. But when I call the global variable inside my expression builder, its value is null but when I pass it through tLogRow, it gives me the correct value. Can you help me with this?

 

I am trying to populate the primary key for my incremental load.

0683p000009M7ip.png0683p000009M848.png

Labels (1)
  • v7.x

1 Solution

Accepted Solutions
manodwhb
Champion II
Champion II

@uchihammd ,  please find the below solution.

 

0683p000009M8VT.png0683p000009M8T4.png0683p000009M8As.png

View solution in original post

12 Replies
manodwhb
Champion II
Champion II

@uchihammd , you need to  design the below way to call the global var in tmap. have you design this way?0683p000009M8V9.png

Anonymous
Not applicable
Author

Hi @manodwhb ,

That was the design I was using. Initiating the global variable using a prejob. But, it was not working.

I have attached the screenshot below.

In that, If I call my Variable in tlogrow. It works. I just print it immediately after the globalvariable component.

The same doesn't work if I print it in a tjava component.

The tJava component has a simple print statement.

System.out.println((Integer)globalMap.get("myKey"));

Can you please point out what I am doing wrong?

 

0683p000009M8U7.png0683p000009M8Sp.png

manodwhb
Champion II
Champion II

@uchihammd , You need to use on Component of from tSetGlobalvar to tjava.then it will work.

Anonymous
Not applicable
Author

Hi @manodwhb ,

In the second screenshot, I have used tjava from tSetGlobalVar. Shouldn't it work?

manodwhb
Champion II
Champion II

@uchihammd , no it will give null, since tjava code execute first , you have to use trigger from tSetglobalvar  like on component ok.

Anonymous
Not applicable
Author

Hi @manodwhb ,

I used the condition. But, I am still getting null. Please find the screenshot below.

0683p000009M8VJ.png

manodwhb
Champion II
Champion II

 

 @uchihammd ,should be  below way in tjava

System.out.println((Integer)globalMap.get("maxrow"));

Anonymous
Not applicable
Author

Hi @manodwhb ,

This is my code. While querying from the db, I get the max of the particular column. So, I will have just one row. And I am calling that row. So,I don't think I need to call maxrow.

0683p000009M8VO.png0683p000009M8OE.png

manodwhb
Champion II
Champion II

@uchihammd ,  please find the below solution.

 

0683p000009M8VT.png0683p000009M8T4.png0683p000009M8As.png