I really appreciate the help so far - but I'm beginning to tear my
hair out (and I haven't much left!)
My script is simply:
<script>
window.MyData = {};
window.MyData.d = store.getTaggedTiddlers("CCF2009");
window.MyData.e = store.getTaggedTiddlers("CA2009");
return e;
</script>
which returns the result ReferenceError: e is not defined
On Jul 21, 5:03 pm, Eric Shulman <[email protected]> wrote:
> > If I run:
> > <script>return store.getTaggedTiddlers("CA2009").length </script>
> > I get nothing...
> > If I run:
> > <script>return "No.= " + store.getTaggedTiddlers("CA2009").length </
> > script>
> > I get No.= 6
> > the right answer!
>
> In order to render output, the return value from an inline script must
> be a text string. Try this:
>
> <script>return store.getTaggedTiddlers("CA2009").length.toString(); </
> script>
>
> > but how can I assign it to a variable for later use...
>
> Variables declared within an inline script are only in scope until the
> end of that script. To store a persistent variable, you can
> explicitly declare it in the global 'window' context, like this:
>
> <script>window.someVariable=store.getTaggedTiddlers
> ("CA2009").length;</script>
>
> and, to keep the global 'namespace' cleaner, especially when storing
> multiple values, you can create your own global object and then save
> the values within that object, like this:
>
> <script>
> window.myData = {}; // empty object
> window.myData.someVariable = ...
> window.myData.someOtherVariable = ...
> </script>
>
> enjoy,
> -e
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/TiddlyWiki?hl=en
-~----------~----~----~----~------~----~------~--~---