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

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Storing Date-time in a variable from tMSSQLinput query and using it in another tMSSQLinput

Hi Everybody,

I'm very new to TOS and I have almost a similar situation in MS SQL where i'm suppose to insert latest records to a table AC. So I'm trying to get max Date from AC to know which records to fetch from another SQL DB. For this as per above diagram i have started with a tMSSQLinput_1 component with above mention query then i want to store the result set of  tMSSQLinput_1 to tSetGlobalVar_2 (not sure if this is the best approach). As you can see i have added a Key and just to test if the results are stored i have used tLogRow_1 Component. but i am getting this error

"Execution failed : object is not an instance of declaring class
Job AgentCubeNew ended at 20:59 06/03/2019. [exit code=0]"

I would like to know is this the right approach?, also where should i write globalMap.put("myValue",*value*) to set the value in my variable from the query ?

Once i'm able to set the variable i would like to call it in another MSSQLinput component to get records from another db table which > max(date) of table AC

Please guide

my talend is Version: 5.6.1

Labels (2)
13 Replies
manodwhb
Champion II
Champion II

@abdulbasit,you can do multiple one is creating context and loading that max date into context and reading that context variable in the next component where you were writing query based on date.

 

and another way is set using tsetGlobalvar. on which component are you getting an error?

Anonymous
Not applicable
Author

@manodwhb
can you see the screen shot and guide me accordingly.
manodwhb
Champion II
Champion II

@abdulbasit ,i see the problem in tSetGlobalVar,value should be like row1.colum with out " ". can you provide that way.

Anonymous
Not applicable
Author

@manodwhb
i have replaced tsetGlobalvar_2 value to row1.maxdate
still the same error
"Execution failed : object is not an instance of declaring class
Job AgentCubeNew ended at 10:29 07/03/2019. [exit code=0]
"
manodwhb
Champion II
Champion II

@abdulbasit ,on which component are you getting that error?

manodwhb
Champion II
Champion II

@abdulbasit ,check the below example,

0683p000009M2GM.png0683p000009M2g7.png0683p000009M1x8.png

Anonymous
Not applicable
Author

@manodwhb Please see the attached
error.jpg
manodwhb
Champion II
Champion II

@abdulbasit ,I relay not able to test your issue. we have dig into one step down,with out tSetGlobalvar was that job running successfully just to keep toracleinput and tlogrow

Anonymous
Not applicable
Author

i think its because of the format of datetime can you try with "yyyy-MM-dd  HH:mm:ss"