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

How to include the assigned value in context variables to tJavaRow

How do I include the value of contexts in tjavarow?

For Example:

This is my job tFileInputDelimited==Main==>tJavaRow==Main==>tFileOutputJSON

 

I'm trying to convert a normal text file into a JSON file, this is my text input:

 

Document,Files (Header)
doc_1, 2 (values)

 

And my output should be like this:

[{"Document":"doc_1 20180914","Files":2}]

 

So, My issue is when I try to include the date value through context it projects me a null value like this:

[{"Document":"doc_1 null","Files":2}]

 

This is the code I'm following in tJavaRow to implement it:

 

output_row.Document = input_row.Document+" "+context.date;
output_row.Files = Integer.parseInt(input_row.Files);

 

Also, I've attached a screenshot, where I need that value in instead of null in my JSON output.

 

Can Anyone help me with this?

Labels (2)
1 Reply
Anonymous
Not applicable
Author

Hello,

Did the tJavaRow receive a row (shown in the metrics of the flow to tJavaRow) ?

Do you want to retrieve the current date when you run the job and your context variable in date format?

Best regards

Sabrina