cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

DB entity service return null when calling from another entity

GY_10982725
2-Explorer

DB entity service return null when calling from another entity

GY_10982725_0-1730180106013.png

I have a service on a database entity, executing a simple select max() operation, when running in the entity, it works and returns a result (number) as shown in the screenshot. but when I call this service from another db entity as below: 

   

    lastTickTimeStamp = Things["Egress_KCT_FTAE"].Get_Last_TicksTimeStamp_Test();

 

it always return null as lastTickTimeStamp;

However, the other serivce (query to return an infotable) on the Things["Egress_KCT_FTAE"] can work in the same location without problem.

ACCEPTED SOLUTION

Accepted Solutions

The SQL service returns an infotable, so  to get the value you might need to do lastTickTimeStamp .rows[0].lastTickTimeStamp. Use alias in the SQL like MAX(lastTickTimeStamp ) AS lastTickTimeStamp 

View solution in original post

2 REPLIES 2

The SQL service returns an infotable, so  to get the value you might need to do lastTickTimeStamp .rows[0].lastTickTimeStamp. Use alias in the SQL like MAX(lastTickTimeStamp ) AS lastTickTimeStamp 

Hello @GY_10982725,

 

It looks like you have a response from a community member. If it helped to answer your question please mark the reply as the Accepted Solution. 

Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.

Thanks,
Vivek N.
Community Moderation Team.

Announcements


Top Tags