Skip to main content
12-Amethyst
August 31, 2023
Solved

Usage of remoteMethodServer.invoke and RemoteMethodServer.ServerFlag

  • August 31, 2023
  • 1 reply
  • 1908 views

Hello community!

 

I am looking through the PTC | Windchill code right now and I am encountering a lot of if(RemoteMethodServer.ServerFlag) { run code } else { remoteMethodServer.invoke(...)} constructs.

 

I am figuring this means something like "If the code is executed server-side then continue, otherwise invoke the method on the particular method server". But where would this code be executed, if not on the method server?

 

Can anyone please give me a better / more technical explanation. Why is it important to use this construct and when should you use it?

 

Thanks in advance and best regards

Best answer by HelesicPetr

Hi @TG_10272716 

The code can be run from Windchill shell, that moment you should care what MS you want to use or you can get the default one. 

If method server is not available then code fails

PetrH

1 reply

HelesicPetr
22-Sapphire II
22-Sapphire II
August 31, 2023

Hi @TG_10272716 

The code can be run from Windchill shell, that moment you should care what MS you want to use or you can get the default one. 

If method server is not available then code fails

PetrH

PetrH
12-Amethyst
September 6, 2023

Hi @HelesicPetr, thank you for your reply. So, this basically means that I have to implement some kind of check (like mentioned above) whenever the code can or might be executed in the Windchill Shell.

 

Are there any other cases where this is required, what about Queues? Isn't there a difference between executed by Windchill (scheduled queue) and executed by the user (click)?

 

Best regards

HelesicPetr
22-Sapphire II
22-Sapphire II
September 6, 2023

Hi @TG_10272716 

I would say yes . 

queue is run on the method/background server directly so you do not need to cares about the check

PetrH

PetrH