Five Stars

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

1 REPLY
Fifteen Stars

Re: Can we fetch column names from the input in tJavaRow ?

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.

Rilhia Solutions