5 Replies Latest reply on Oct 17, 2006 8:18 AM by aBill

    Null Values from a Data Source

    Chris_Maloney
      This is more of an implementation question than a troubleshooting question. Also, since I've been unable to find any documentation on this I was wondering if anyone has come across this behavior or found a bug with it.

      Yesterday I was working on an application to explore some proof of concept aspects of Flex for an application I'm developing. I started running into a problem with Flex Data Services throwing back an 'Unknown Property: "clientaddress1"' error whenever I tried to update data. It seemed that whenever I tried to update a record in the database it would thrown the Unknown Property error. I spent a good chunk of the day trying to figure out what was causing this and finally gave up and called it a day.

      This morning I was reassessing what the problem was and trying to find the differences between my database and my code and I stumbled upon the fact that I could add no records and modify them without a problem, however if I tried to access an existing record and update it I'd get the Unknown Property error.

      I start analyzing the database and found that I'd configured the database to use null values for empty values and the records that I created with the database had null values, however, any of the values inserted from Flex were inserted as blank values. As matching my action script class as clientaddress1 = ""; So, upon further testing I fould that Flex was not processing the null values correctly, so that when it came back and rightly generated a Conflict Error...and then called AcceptServer() it was unable to find the clientaddress1 property of the class.

      Also, if any of the properties in the database are null it throws the same error. Basically it seems to have invalidated the object just because one value was null. So if all of my values from the DB are set to something and only one field is set to null it's still throwing the error on the first alphabetical item of the properties.

      I can resolve the problem by not using null values in the database, but...what sort of effect would this have on someone working with a large legacy database that extensively uses nulls for undefined values?

      Also, if a Flex guru could explain the reasoning for this happening I would greatly appreciate it!

      Best regards,
      Chris Maloney
        • 1. Re: Null Values from a Data Source
          aBill Level 1
          Hi,

          Are you using HibernateAssembler? Can I have your actionscript class source?

          Thanks!
          William Chan
          • 2. Re: Null Values from a Data Source
            Chris_Maloney Level 1
            I realize that I didn't clarify that I am using ColdFusion for getting the data. This class was generated by the Create CFC wizard in Flex Builder.

            package com.generated
            {
            [Managed]
            [RemoteClass(alias="components.generated.clients.Clients")]

            public class Clients
            {

            public var clientid:Number = 0;
            public var clientfirstname:String = "";
            public var clientlastname:String = "";
            public var clientaddress1:String = "";
            public var clientaddress2:String = "";
            public var clientcity:String = "";
            public var clientstate:String = "";
            public var clientzip:String = "";
            public var clientphone:String = "";
            public var clientemail:String = "";


            public function Clients()
            {
            }

            }
            }
            • 3. Re: Null Values from a Data Source
              aBill Level 1
              Hi,

              Can you remove the initial empty string and try again! Thank you!

              William Chan
              • 4. Re: Null Values from a Data Source
                Chris_Maloney Level 1
                I've tried setting the values to null and still I get the same result. Is this the classic "ColdFusion has problems with Null values" thing? The CFC created by the CFC Wizard assigns all the intial values to ="" as well, I was browsing the docs and found that using Asc() would return an undefined value and I attempted that but it just caused CF to throw errors.

                • 5. Re: Null Values from a Data Source
                  aBill Level 1
                  Hi

                  I talked to the coldfusion engineers. I find cf have no null datatype. In this case, i think the only solution is modifying the generated assembler cfc' s update "where cause"

                  William Chan