M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

empty label always display undefined

Can you add a screenshot of the mapping

She
Posts: 0
Joined: Wed Oct 08, 2014 12:46 am

empty label always display undefined

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

M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

empty label always display undefined

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

M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

empty label always display undefined

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

M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

empty label always display undefined

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

M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

empty label always display undefined

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

M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

empty label always display undefined

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

She
Posts: 0
Joined: Wed Oct 08, 2014 12:46 am

empty label always display undefined

sad to say, the alert not fires.

Return to “Issues”