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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Are infotable outputs passed to other services by value, not by reference?

steve237
13-Aquamarine

Are infotable outputs passed to other services by value, not by reference?

I assumed that they are passed by reference, so that modifications to an input would persist for subsequent calls by other services.

Let's say I have a service named "test" that has two infotable inputs (input_a and input_b).

steve237_0-1597369565791.png

This service is called by two services named service1 and service2.  The data from service1 is bound to input_a and the data from service2 is bound to input_b.

 

The test service needs to know which service called it, so I check the number of rows to make that determination.  Then at the end, I purge each infotable, so that the inputs are empty on the next call.  For example, let's say that service1 makes the first call, then service2 makes the next call.  For the code to work properly when service2 makes the call, input_a must be empty.  However, when service2 makes the call, input_a is somehow populated and the first if statement evaluates to true.  So, the purges aren't having an affect because the input_a is repopulated when service2 makes the call to test.

 

So, it appears that each time a service is invoked, it even refreshes infotable inputs (gets a copy by value) that are not supplied by the calling service.  Using my example, when service2 makes the call to test service, test service goes out and gets a copy of the infotable from the last time service1 was invoked.

 

Is that correct?  Is there any documentation on this subject?

 

Thanks,

Steve

1 REPLY 1
CharlesJi
15-Moonstone
(To:steve237)

Hi @steve237, I believe it passes value, not reference. 

 

If you want to influence an infotable outside, you can edit it through service and return its value, then you can update the target infotable with the resultant.

Announcements


Top Tags