Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
Hi, I have an extension which contain one service where data from csv file is loaded into an infotable and service return type is infotable. Service throws custom exception if anything fails or data is not valid in csv. In thingworx, I am calling the extension service using a snippet service, now I need to validate the service response whether the response contains an infotable or is an error message returned from the service. Incase of error, I need to show it on mashup to end user. The issue is how to validate the response whether its an infotable or an error message. Appreciate help in advance.
@DeepakParihar I think the simplest approach would be to check if the response has rows [if(!!response.rows){.....}], if it has then is an infotable, if its a string other wise it would be the error message, If you are throwing an exception than you can wrap it around try catch and handle accrodingly. I am not sure if ThingWorx has anything native to check if it is a valid Infotable, may be you can check in snippets.
Hi @Bikash_Panda Thanks for your response. The return type of snippet service is an infotable and Validator does not accept infotable as an input. so how it is possible to validate the response.
Maybe you can use a Data Service Notification instead of a validator. If your extension service returns an error, a notification message will pop up in the mashup.
Here's the help center link for adding notifications:
Hi Steve, thanks for your response. That is the one way to achieve this. But I need to display error message using modal popup. So, Is there a provision to achieve this using modal popup? And if I convert service response (Infotable) to Json using ToJSON() and pass it to validator. The validator gets json object as blank even if data is present. What can be the cause being a blank object.
Hi @DeepakParihar,
I wanted to see if you got the help you needed.
If so, please mark the appropriate reply as the Accepted Solution. It will help other members who may have the same question.
Please note that industry experts also review the replies and may eventually accept one of them as solution on your behalf.
Of course, if you have more to share on your issue, please pursue the conversation.
Thanks,