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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Get value after every n counts

Hi,

 

I get the max(ID) from the table which is BigDecimal(7,0). This value I am passing to tJavaRow component to assign the value to globalMap as below:
globalMap.put("startID", "1");
globalMap.put("endID", String.valueOf(row1.maxID));
globalMap.put("rowsToProcess", "40000000" );

OnComponentOK, connecting to tLoop component where the For loop is chosen as below:

From - 1

To - Integer.parseInt(globalMap.get("endID").toString())

Step - Integer.parseInt(globalMap.get("rowsToProcess").toString())

 

This raises NumberFormatException. 

java.lang.NumberFormatException: For input string: "4979013401".

 

Is there any other way to generate value from start id to end id every n'th value.

 

Thanks.

Labels (3)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

Max value for an integer is 2,147,483,647...

View solution in original post

6 Replies
TRF
Champion II
Champion II

Max value for an integer is 2,147,483,647...

akumar2301
Specialist II
Specialist II

4979013401 is higher than above maximum possible value for Int 

 

Instead try Long but you have to use While Loop instead of For( doesnot support Long)

 

start condition

 

 Long i = 0L

 

Anonymous
Not applicable
Author

Hi TRF,

 

System.out.println((Long)globalMap.get("tLoop_1_CURRENT_VALUE")); is returning NULL in tJava component.

 

How do I get the tLoop value ?

 

Thanks.

Anonymous
Not applicable
Author

Hi,

 

System.out.println((Long)globalMap.get("tLoop_1_CURRENT_VALUE")); is returning NULL in tJava component.

 

How do I get the tLoop value ?

 

Thanks.

Anonymous
Not applicable
Author

Hi,

 


System.out.println((Long)globalMap.get("tLoop_1_CURRENT_ITERATION"));

 

globalMap.get("tLoop_1_CURRENT_ITERATION") is by default Integer. 

int current_iteration_tLoop_1 = 0;

 

How would it transfer Long value?

 

Is there any other way to achieve this?

 

Thanks.

 

akumar2301
Specialist II
Specialist II

Hmm , If you need to use counter value in long
Immediately after tloop put a tjava and create a your own long globalmap
counter and use that custom value in your subjob