Your CFML code is buggy. Remove the GoogleWrite and GoogleRead calls,
and simply put the following after the CFSCRIPT where you create and
initialize TestCFC:

  <cfdump var="#TestCFC.getProp1()#">

You'll see that it throws the same exception (yes, CF8 does too). The
problem is that function arguments get copied to the function local
scope so that you can reference them without using "arguments."
notation. Therefore, within the "setProp1" function, references to
"prop1" and "arguments.prop1" refer to the same local variable, and
the following code just assigns "arguments.prop1" back to itself:

  <cfset prop1 = arguments.prop1 />

You need to create a new variable in either the "this" or "variables"
scope, either by explicity referencing the scope (the recommended
solution):

  <cfset variables.prop1 = arguments.prop1 />

or by giving it a different name (the following is the same as
"variables.property1"):

  <cfset property1 = arguments.prop1 />

Finally, note that the CFPROPERTY tags currently have no effect on
GoogleRead/Write. As I mentioned previously, all variables within the
CFC "this" and "variables" scopes are searchable properties when you
write to the Google datastore. In the future we may restrict that only
to properties defined by CFPROPERTY tags, but for now we don't.

Vince

On Jun 2, 2:51 am, Baz <[email protected]> wrote:
>
> I wrote some simple test code to write and read a cfc from the Google
> Datastore, included below. It creates a test cfc, sets a few properties to
> simlpe values, GoogleWrite()'s the cfc to the google datastore, then reads
> back the cfc from the google datastore into a new variable. If that new
> variable is dump'ed, the component defintion along with its functions,
> displays successfully. If I try and get a property value, however, the
> variable is undefined. It seems that property values did not survive the
> write.
>
> Is there something wrong with the test code or some other issue to consider?
> The google dashboard (under the heading "Data Viewer") doesn't show any
> objects saved either.
>
> Cheers,
> Baz
>
> *Contents of index.cfm*
>
> <!--- create and populate testcfc --->
> <cfscript>
>     TestCFC=createobject('component', 'testcfc');
>     TestCFC.setProp1(123);
>     TestCFC.setProp2(now());
>     TestCFC.setProp3('this is a string');
> </cfscript>
>
> <!--- write component to datastore --->
> <cfset Google_Key=TestCFC.GoogleWrite() />
>
> <!--- read back the object --->
> <cfset ReadTestCFC=GoogleRead(Google_Key) />
>
> <!--- ERROR: Variable PROP1 does not exist.) --->
> <cfdump var="#ReadTestCFC.getProp1()#">
>
> *CFML Runtime Error**Variable PROP1 does not exist.*Request/index.cfmFile
> Trace/home/baz/Source/GAE-OpenBD/war/index.cfm
> |
> +-- /home/baz/Source/GAE-OpenBD/war/testcfc.cfc
>
--~--~---------~--~----~------------~-------~--~----~
Open BlueDragon Public Mailing List
 http://groups.google.com/group/openbd?hl=en
 official site @ http://www.openbluedragon.org/

!! save a network - trim replies before posting !!
-~----------~----~----~----~------~----~------~--~---

Reply via email to