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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Use a Service from Thingworx

SebastienV
6-Contributor

Use a Service from Thingworx

Hello,

 

I am working on a project connecting Thingworx and Vuforia Studio.
Right now I'm trying to use a service imported from Thingworx. This service takes a string as input, and outputs the name of a Thing (this works well on Thingworx when I test my service), this allows me to call the Thing of my choice to display its data.

 

However after having imported this service in Vuforia Studio, and having made the connections which seem correct to me, the service does not run. The input string comes from a textInput and the output Thing goes into a Dynamic Entity Name to change the current Thing on the data display.
For the connections I have linked the text of the textInput to the input parameter of my service, and the output, the Current Selected Element, I redirect it to the Dynamic Entity Name of the displayed Thing to change the current Thing. But when I test, in Preview, and that I put a character string in the textIput, the service is not called because the displayed data does not correspond to those of the Thing that I ask (whereas if I put the name myself of a Thing in the Dynamic Entity Name, the display works as expected, so the problem seems to be with the service).

 

What do you think I am missing for my service to lunch?

What can I do to fix it?

 

Thank you for the support.

Greetings

Sébastien

8 REPLIES 8

If I understand correctly you are setting the input from a text input box to a simple service that returns the Thingname. Do you have an event that causes the service to execute. For example you could use Value Changed event   

sgreywilson_0-1640713015713.png

 

Thank you for your reply, you understand the situation correctly.
I have tried this exact same setup and nothing appears in the label when I enter something expected in the text input.

It is as if the service does not launch, despite the Value Changed event as a trigger for the service.

2 things make sure you tab out of the field otherwise you will not get a change event and second try binding the service the a button to make sure the service is executed. Check Thingworx script log for errors (add a log statement in the service to register execution). If non of this helps share your project and service and I will take a look

None of this solved my problem so I am sending you my project, thank you very much if you can take a look.
You will find my problem in the "AGV identification" view, in the 2D Overlay and the name of the service I am talking about is GetThingName.

pandersson
13-Aquamarine
(To:SebastienV)

Hello, 

I prefer to manage services in the js code. Here is one example where I start a service when open the expereince and then wait for the service to complete.

 

$scope.$on("$ionicView.afterEnter", function (event) {
console.log($scope.app);

$scope.$root.$broadcast('app.mdl.remoteDesignShareUtils.svc.getModelURL',{"OID" : $scope.app.params['partOID']});

$scope.$on('getModelURL.serviceInvokeComplete', function() {

$scope.view.wdg['model-4']['src'] = $scope.app.mdl['remoteDesignShareUtils'].svc['getModelURL'].data.current['result'];


});

});

@SebastienV I looked at your example and If I understand you was wanting a user to enter a Thing name and then navigate to a new view - I can't try it out as I don't have access - so I put together a video that I help helps - let me know 

Thank you very much for your reply, my problem is now solved.

 

If I understand correctly, the problem was that the service didn't start systematically before I changed the View, and once I went to the next View the service could not be started anymore.

The solution is to check both "Auto-select first row" and "Auto-refresh" (1 sec as rate) in the Configuration section of the service.

 

SebastienV_2-1641302084265.png

 

 

Once again thank you very much for the support.

@SebastienV 

 

Sounds good glad it was helpful. 

Another thought I might be tempted to use application parameters and store the name entered in application param CURRENT_SELECTED

This value is a global value across all views.

 

If you have a model in the view you are navigating too you can use model loaded event to execute the getname service with CURRENT_SELECTED as the binding to the input parameter. This could remove to 1 sec constant getname execution which is really a   resource hog

Top Tags