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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Call function in a service from different service in a Thing

LS_8369616
7-Bedrock

Call function in a service from different service in a Thing

Hello,

 

I'm creating multiple services in a Thing and i would like to know if it is possible to call function i've created in "Service1" in "Service2" ?

This to not rewrite the function again to have a proper code.

 

Thank you,

Best Regards,

2 REPLIES 2
PaiChung
22-Sapphire I
(To:LS_8369616)

You can call the service, but not a specific function inside that service, unless you set it up with some input parameters to function like that.

If you have functions you want to 're-use' you should create some 'Toolbox' Thing with those supporting services, or create an extension and add them as a resource.

ashaban
12-Amethyst
(To:LS_8369616)

Hi,

 

If I understand you correctly:

1. You have a Thing with two services, Service1 and Service2

2. To call Service1 from any other service of the same thing you can use the "me" like that.

 

result = me.Service1();

 

See the example attached.

ashaban_0-1640071934395.pngashaban_1-1640071965101.png

 

 

 

Hope it helps.

Announcements


Top Tags