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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Can we fetch column names from the input in tJavaRow ?

I am trying to do some validation . So i am calling the validation routine in tJavaRow. 

Is it possible to get column names and column values from the input  using any function .

like i am doing ->  input_row.col1+","input_row.col2 and passing the entire record and also column name as input to validation routine. So instead of writing manually , can we extract the value and column name from input_row class ?

 

Thanks,

Manish

Labels (3)
1 Reply
Anonymous
Not applicable
Author

There is potentially a bit of a hack for this. I have used this in the past. Look at the name of the row being passed into your tJavaRow (for example, row1). In your tJavaRow use the following code (replacing row1 with your row name).....

 

System.out.println(row1.toString());

You will see that you get a String that will look similar to the below....

 

testproj.testrich_0_1.Testrich$out1Struct@5a1c0542[day=1,todaysDistance=100.0]

In this test, my columns are called "day" and "todaysDistance".

 

All you need from here is to write a simple routine to pull the column name and column value from between the square brackets.