Thansk for the insightful reply. I'm new to flex and am working on an application that was created long before I started on it. I have been refering to existing code to progress my knowledge and have also been reviewing best practices online. The existing code doesn't use strongly typed objects but that is what I'm used to so my development has been using that methodology, actually the boolean assignment is occurning while mapping to a VO. I will use e4x from now on. Thanks again for taking the time to enlighten me. Greg ________________________________
From: [email protected] [mailto:[email protected]] On Behalf Of Tracy Spratt Sent: Thursday, March 19, 2009 9:20 PM To: [email protected] Subject: RE: [flexcoders] httpservice formatted as Object 0 = "0" but 1 = 1 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: [email protected] [mailto:[email protected]] On Behalf Of Gregory Kelley Sent: Thursday, March 19, 2009 7:19 PM To: [email protected] 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: [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

