[resolved] Component uses default context value instead of just loaded one

Six Stars

[resolved] Component uses default context value instead of just loaded one

Hello,
I'm loading context from a csv file in a prejob and after it is loaded I print it with tjava component and it shows me a correct value.
However when I try using it in a tSalesforceGetUpdated as a start and end dates, the component seems to use the default dummy values instead of just loaded ones. 
Does anyone has any idea how to fix this?
Any help is very much appreciated!

Gabriele
Moderator

Re: [resolved] Component uses default context value instead of just loaded one

Hi,
Could you please give us your job setting screenshots? In this way, we can see if there is something wrong with your setting.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: [resolved] Component uses default context value instead of just loaded one

Hello, of course: So the dates are correct in the context that I load, but too early in the defaults. It seems like context values are set, but the component still uses the defaults.
Ten Stars

Re: [resolved] Component uses default context value instead of just loaded one

Are you sure that the default dates are being used or is that an assumption? Could you set the default dates to the ones you think are correct (the ones you are setting using the tContextLoad) and let us know what happens?
Six Stars

Re: [resolved] Component uses default context value instead of just loaded one

Yes, if I put the same dates I load in context as default values then it runs:
Ten Stars

Re: [resolved] Component uses default context value instead of just loaded one

OK. here used to be an issue with setting context variables in code (in tJava) components that would happen like this, but you are using the tContextLoad. This is strange. The only thing I can think of adjusting is to link your subjobs using the OnSubJobOK connectors rather than the OnComponentOK connectors. If that makes a difference, this could be a bug.

Also, could you show us how the Salesforce component is configured if the above doesn't solve your issue.
Six Stars

Re: [resolved] Component uses default context value instead of just loaded one

I changed to onSubjobOk links - nothing changed.

Also, if I do not set any default values for context variables, then it throws an error :

in the java code:


it seems ir can't find any value. Altough tJava component can successfuly print loaded values, but the Salesforce component can't see it.

Six Stars

Re: [resolved] Component uses default context value instead of just loaded one

Yes, the component configuration:

Six Stars

Re: [resolved] Component uses default context value instead of just loaded one

Thank you for your help.
I still don't know why the loaded context can't be reached from the tSalesforceGetUpdated component, but
I was able to get the functionality I needed by setting global Map variable in the tJava with the loaded context value:
globalMap.put("LastCheck", context.timeLast);
and writing expression directly in the tSalesforceGetUpdated component field:
Start Date: (String)globalMap.get("LastCheck")
End Date: TalendDate.getDate("CCYY-MM-DD hh:mm:ss" )
Ten Stars

Re: [resolved] Component uses default context value instead of just loaded one

This appears to be a bug with the component. https://jira.talendforge.org/browse/TDI-36865

Just saw your post. Given the description of the problem in their Jira, I am surprised that works. However, if it does that's great!

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Talend API Designer – Technical Overview

Take a look at this technical overview video of Talend API Designer

Watch Now

Getting Started with APIs

Find out how to get started with APIs

Read