Skip to main content
1-Visitor
January 21, 2019
Solved

Service Failure

  • January 21, 2019
  • 2 replies
  • 1387 views

I have a service retrieving a json file from several devices via the contentloaderfunction getjson. After the json is retrieved I parse the data and output an infotable and display the values in a mashup. If the service fails the widgets displaying the data show errors on my mashup. I would prefer to show no data vs an errored widget. Is there anyway to have the service return an empty infotable?

Best answer by eengelbrecht

Place the script of your service in a try catch and have an empty table equal to the result of your script if it goes into the catch. for example:

 

try {
//insert current script here

result = PopulatedInfotable
}
catch(err) {

result = emptyInfoTable
}}

 

Hope that helps

2 replies

5-Regular Member
January 22, 2019

Hello,

 

I can see 2 possible solutions to not store errors in the infotable.

The first that comes to my mind is a workaround, you could do a regular expression match on the values after they have been fetched. The regular expression should match a common term in the error messages, like "error" or "warning". If the expression matches you don't store it in the infotable.

 

The second would be to check for possible errors while receiving, in case of error, to not use the variable for Infotable input. I haven't tested this however.

 

Regards,

Pascal

1-Visitor
January 24, 2019

Place the script of your service in a try catch and have an empty table equal to the result of your script if it goes into the catch. for example:

 

try {
//insert current script here

result = PopulatedInfotable
}
catch(err) {

result = emptyInfoTable
}}

 

Hope that helps