Page 3 of 4

empty label always display undefined

Posted: Wed Jan 28, 2015 8:42 am
by M&M

Can you add a screenshot of the mapping


empty label always display undefined

Posted: Wed Jan 28, 2015 8:43 am
by She

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(" ");
}


empty label always display undefined

Posted: Wed Jan 28, 2015 8:45 am
by M&M

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("");


empty label always display undefined

Posted: Wed Jan 28, 2015 8:46 am
by M&M

what is data[0] ... because if that evaluates to false then the labels won't get cleared


empty label always display undefined

Posted: Wed Jan 28, 2015 8:49 am
by She

empty label always display undefined

Posted: Wed Jan 28, 2015 8:53 am
by M&M

There is a simple trick that you could use

  1. Have a local storage variable

  2. Set it to zero in the before Send event (Before Send Event)

  3. Set it to 1 in successful (Success Event)

  4. Set it to 2 in unsuccessful (Error Event)

  5. 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


empty label always display undefined

Posted: Wed Jan 28, 2015 8:53 am
by She

empty label always display undefined

Posted: Wed Jan 28, 2015 8:56 am
by M&M

Put an alert box in the Error event and check if that fires - when the REST does not return any values


empty label always display undefined

Posted: Wed Jan 28, 2015 8:57 am
by M&M

If the alert fires, then just put the code to clear the labels in that place


empty label always display undefined

Posted: Wed Jan 28, 2015 9:08 am
by She

sad to say, the alert not fires.