That is the problem with the object being inconsistent. Since any string
representation is not 0 it becomes true. 
 
So in order to get around the bug I have to do boolean(int(value)); That
way if value comes back as a stirng it is properly cast to an int then
to a boolean. If it comes back as an int then the int(value) is
irrelevant and it is still cast to a boolean correctly.
 
Greg

________________________________

From: [email protected] [mailto:[email protected]] On
Behalf Of Maciek Sakrejda
Sent: Thursday, March 19, 2009 3:18 PM
To: [email protected]; [email protected]
Subject: RE: [flexcoders] httpservice formatted as Object 0 = "0" but 1
= 1



Could this have something to do with the fact that 0 coerced to a
Boolean is false and '0' is true, whereas both 1 and '1' are true?


-----Original Message-----
From: [email protected] on behalf of Gregory Kelley
Sent: Thu 3/19/2009 9:32 AM
To: [email protected]
Subject: [flexcoders] httpservice formatted as Object 0 = "0" but 1 = 1

I have the following line in the xml returned from the call.

<rsp stat="ok">
<type>Partner</type>
<object inv_text_end_dt="" is_comm_paid="0" override_type_id="" />
</rsp>

When I reference event.result.rsp.is_comm_paid the result is "0"

Now if I pull a record where the value is 1 then the xml looks like
<rsp stat="ok">
<type>Partner</type>
<object inv_text_end_dt="" is_comm_paid="1" override_type_id="" />
</rsp>

When I reference event.result.rsp.is_comm_paid the result is 1

Anyone see this before?

If I need to create a sample I can but it would be late next week, For
now I cast it as int then let it get coerced into a boolean.

Thanks,
Greg





Reply via email to