empty label always display undefined
Can you add a screenshot of the mapping
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
Can you add a screenshot of the mapping
oh im sorry i already deleted that code so i just retyped it.
if (data[0])
{
Appery('label1').text(" ");
Appery('label2').text(" ");
Appery('label3').text(" ");
}
Just add an alert box to the "Error" event of REST Service. See if that fires. If it does
Then just add these 3 lines at that place
Appery('label1').text("");
Appery('label2').text("");
Appery('label3').text("");
what is data[0] ... because if that evaluates to false then the labels won't get cleared
There is a simple trick that you could use
Have a local storage variable
Set it to zero in the before Send event (Before Send Event)
Set it to 1 in successful (Success Event)
Set it to 2 in unsuccessful (Error Event)
In the Complete Event read it's value (1 or 2?)...If it is 2 (Error event) then clear the labels with the following commands
Appery('label1').text("");
Appery('label2').text("");
Appery('label3').text("");
Alternatively you can also read one the mapped variables or components. If it doesn't have - say a numeric value / or a valid date, then you can assume that the REST Call was not able to return results...and so you can just clear the labels
Hope that clarifies it
Put an alert box in the Error event and check if that fires - when the REST does not return any values
If the alert fires, then just put the code to clear the labels in that place
sad to say, the alert not fires.