This is probably happening because you have left the resultFormat at the
default "object".  The object decoder attempts to be smart and changes the
xml strings into what it thinks the data types should be.  It often guesses
wrong.

 

Set the resultFormat="e4x" and you will get your data reliably.  It will
always be strings, but it will be the strings that were sent.

 

There are other reasons not to use resultFormat="object" as well.  Best
practice (with HTTPService) is to get the XML in pure e4x form, then convert
it yourself into an ArrayCollection of strongly typed value objects.

 

Tracy Spratt,

Lariat Services, development services available

  _____  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Gregory Kelley
Sent: Thursday, March 19, 2009 7:19 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] httpservice formatted as Object 0 = "0" but 1 = 1

 

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: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Maciek Sakrejda
Sent: Thursday, March 19, 2009 3:18 PM
To: flexcoders@yahoogroups.com; flexcoders@yahoogroups.com
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: flexcoders@yahoogroups.com on behalf of Gregory Kelley
Sent: Thu 3/19/2009 9:32 AM
To: flexcoders@yahoogroups.com
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