One Star

how to fetch the value?

Hi All,
I m trying execute one command/function using tMongoDBRow component and
I wanna process the output returned by tMongoDBRow.
and  I m getting following output when I execute the tMongoDBRow independently.
{ "serverUsed" : "vchngskeoes2-01/10.85.17.35:27017" , "retval" : 0.0 , "ok" : 1.0}
what can be done to get the value stored in retval of above json returned, so that I can use it in the some other component.
13 REPLIES
One Star

Re: how to fetch the value?

Any one please help me on this whether its feasible or not?
Seventeen Stars

Re: how to fetch the value?

One Star

Re: how to fetch the value?

Hi Laurent,
Thanks for your reply Smiley Happy.
I m getting the following error while trying to use tExtractJsonField.
Error on line 1 of document  : Premature end of file. Nested exception: Premature end of file.
and warning on the component viz., "this component should have a input link(s)"
Thanks,
karthi.
Five Stars

Re: how to fetch the value?

can you show us your job design? 
Seventeen Stars

Re: how to fetch the value?

i've tried to read your json  {"serverUsed" : "vchngskeoes2-01/10.85.17.35:27017" , "retval" : 0.0 , "ok" : 1.0} with any kind of problem.


regards
One Star

Re: how to fetch the value?

Hi,
Thank you @umesh and @kzone for you reply.
PFB my job design.


earlier I didn't have tFixedFlow component I just now added after seeing the reply.
but the thing is I m getting the return value as null even though it returns 11.0 as we can see in the output window.
Is it right to connect using "Iterate" or I need to use any global variables (if present).
Five Stars

Re: how to fetch the value?

Hi Karthisam, 
To demonstrate Kzone has used tFixedFlowInput component. you don`t need that, just remove  tFixedFlowInput component and connect MongoDbRow to tExtractJsonField component. it should work. 
One Star

Re: how to fetch the value?

Hi Umesh
I have tried to connect tmongodbrow directly but the thing is it has only "iterate" and doesn't have "row" to connect to another component,  because of which I m getter exception which I have already posted.
Will post the screen shot of the original project tomorrow.
Thank you.
Seventeen Stars

Re: how to fetch the value?

have a look at talend help about mongo component :
https://help.talend.com/search/all?query=tMongoDBRow&content-lang=en
I guess that you should use tmongoinput instead of *row.
regards
laurent
One Star

Re: how to fetch the value?

Hi Laurent,
Thanks for the reply.
thing is I need to use count function and tmongodbinput has no option for it so only tried to use tmongodbrow.
will try to loop and get the count from tmongodbinput.
Thanks,
karthi.
Seventeen Stars

Re: how to fetch the value?

you can  monitoring the flow to retrieve number of lines (right -clic on the fom & adavanced settint 'monitor this connection')
regards
One Star

Re: how to fetch the value?

I have used 'return_tMongoDBRow_1' variable which helped me to get the return value of the function.
Thank you everyone agian Smiley Happy,
karthi.
One Star

Re: how to fetch the value?

Please help me how you returned 'return_tMongoDBRow_1' variable 
8,00,000 records. looping all the records and finding count is stupid i felt. it is taking nearly 15 mins time. 
Please post me your function urgently