I want to extract the values of few fields from tExtractJSONFields and update a Database record

Highlighted
Four Stars BN
Four Stars

I want to extract the values of few fields from tExtractJSONFields and update a Database record

I want to extract the values of few fields from tExtractJSONFields and update a Database record. I can see the extracted values through tLogRow.

I can create an intermediate excel file with the extracted values and update a DB record, but don't want handle an intermediate file.Instead would like to get the values in context or global variable or something else and update a record in database.


Accepted Solutions
Community Manager

Re: I want to extract the values of few fields from tExtractJSONFields and update a Database record

input_row is the fixed prefix on tJavarow, change it to
context.batchid =input_row.batchid;
----------------------------------------------------------
Talend | Data Agility for Modern Business

All Replies
Community Manager

Re: I want to extract the values of few fields from tExtractJSONFields and update a Database record

Hi BN
If you want to store the value in a context variable or global variable temporarily and use it later, do it on tJavaRow, eg:
...tExtractJsonField--main--tJavaRow
-onsubjobok--other subjobs
on tjavaRow:
context.value=input_row.columnName;
or
globalMap.put("key",input_row.columnName);

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Four Stars BN
Four Stars

Re: I want to extract the values of few fields from tExtractJSONFields and update a Database record

Thanks for your response.

What would be input_row in my case, I tried, Getting an error. Attached the screenshots. 

Community Manager

Re: I want to extract the values of few fields from tExtractJSONFields and update a Database record

I suggest to use tJavaRow to store the value to context variable for used later, but I don't see it in your job.
It is a compilation error, open the Code tab, you will see which line / which component has the error.
----------------------------------------------------------
Talend | Data Agility for Modern Business
Four Stars BN
Four Stars

Re: I want to extract the values of few fields from tExtractJSONFields and update a Database record

Earlier I was defining global variable and now I did it with context variable.

The problem is in the fact that it is not able to get the input_row variable.

I am getting error in the line:

context.batchid = row2.batchid;

I had attached the steps and error in the previous and as well as this post.

In my case what would be input_row.This might sound like a basic Qs.

Four Stars BN
Four Stars

Re: I want to extract the values of few fields from tExtractJSONFields and update a Database record

Earlier I was defining global variable and now I did it with context variable.

The problem is in the fact that it is not able to get the input_row variable.

I am getting error in the line:

context.batchid = row2.batchid;

I had attached the steps and error in the previous and as well as this post.

In my case what would be input_row.This might sound like a basic Qs.

Community Manager

Re: I want to extract the values of few fields from tExtractJSONFields and update a Database record

input_row is the fixed prefix on tJavarow, change it to
context.batchid =input_row.batchid;
----------------------------------------------------------
Talend | Data Agility for Modern Business
IF

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Modern Data Engineering in the Cloud

Learn about modern data engineering in the Cloud

Watch Now

How to deploy Talend Jobs as Docker images to Amazon, Azure and Google Cloud reg...

Learn how to deploy Talend Jobs as Docker images to Amazon, Azure and Google Cloud registries

Blog

Talend API Services Publish to Talend Cloud

Learn how to publish your API Services to Talend Cloud

Watch Now