Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Hi,
i'm trying to give the result of 1 service that is infotable to another service
Please help me out
Solved! Go to Solution.
Hi,
After creating infotable in your service, just put at the end of service:
Thing.property=myinfotable; or me.property=myinfotable
The result of the service can be NOTHING.
Hope it helps,
Raluca Edu
Thank you,
I tried that one too ,
but i'm unable to get the desired output.
how to store that in a new variable.
Hi,
store it in a normal JavaScript variable.
var serviceResult=<service call>;
if not getting, post your code here.
Regards,
Janakiraman
// result: INFOTABLE dataShape: "UDI_CombinedDataShape"
var result = me.combined_new({
udi: undefined /* STRING */
});
var srviceResult = Things["PostgressDbConnector1"].sqlcmnd( {
udiSubmissionReference: result.udiSubmissionReference /* STRING */,
FirstName: result.FirstName /* STRING */;
Above is my code,
I need to store the result1 values in a database.
Hi,
Infotable will be having row(s). If you want to access any value from infotable use row number and column name.
ex: result.getRow(index).columnName;
Hi,
Unable to fetch data by using this also.
var result = me.combined_new({
udi: undefined /* STRING */
});
logger.debug(result.getRow(0).FirstName);
Hi,
var result = me.combined_new({
udi: undefined /* STRING */
});
logger.debug(result.getRow(0).FirstName);
1). pass input param to udi ( if it is required).
2). check your output type is infotable, if not change it infotable.
what error are you getting after executing this service?
Hi,
I dont need Output in infotable,
i just want to see it in logger.debug statement.
actually my main objective of this service is to add the result in database and store in it,
if i get to see values in logger statement then i can manage it further,
Thanks for fast replies.
Hi,
Are you getting any error? if not, did you checked Thingworx script logs?
Error executing service Add_Doc_to_DB. Message :: TypeError: Cannot read property "FirstName" from null - See Script Error Log for more details.
I'm getting the above error.
Hi,
its means,
You are not getting any row from the result, it is an empty infotable. and you are trying to read an index 0 which is first row.
make sure your service is having values in it, then try to read the column(s).
if have values then check the column name.
HI,
I have values in that service and also column name is correct
Hi,
Why aren't you put the infotable result in a thing persistent property, type Infotable? In logger, you cannot see infotable, unless you are accessing every value of it and creating a string with that values.
After that, you can use the infotable property as input in any service you want.
Hope it helps,
Raluca Edu
Hi,
How to add it as thing persistent property
how to add that service result as a particular property
Hi,
After creating infotable in your service, just put at the end of service:
Thing.property=myinfotable; or me.property=myinfotable
The result of the service can be NOTHING.
Hope it helps,
Raluca Edu
Hi Raluca_edu ,
Thank You,
Finally i got it.
// result: INFOTABLE dataShape: "UDI_CombinedDataShape"
var result = me.combined_new({
udi: undefined /* STRING */
});
logger.debug(result.FirstName);
Unable to see the values only .
Hi @Irfan_Pasha.
Since it sounds that you now have a solution, please mark the appropriate response as the Accepted Solution for the benefit of others with the same issue.
Regards.
--Sharon