Creating a customkey from a variable

Pete pete at mollysrevenge.com
Wed Apr 27 14:31:29 EDT 2011


Have you considered a very simple SQLIte database?   A simple table with
columns for student, subject and score, maybe a date related column would
allow you to analyse the data every which way after you've collected it.

Pete
Molly's Revenge <http://www.mollysrevenge.com>




On Wed, Apr 27, 2011 at 10:55 AM, Nonsanity <form at nonsanity.com> wrote:

> Remember that there is the customKeys set and if you do this:
>
> put "ABC" into myCustomPropNameVar
> put "123" into myCustomPropValue
> set the myNewPropSet[ myCustomPropNameVar ] of this stack to
> myCustomPropValue
>
> You are creating a new key set. If you look at the Custom Properties page
> of
> the inspector window, you won't see your "ABC" property in the list. Under
> the list of properties is a pop-up menu called Set. If you look in there
> you'll see "myNewPropSet" and if you select that, you'll see the ABC custom
> property with the 123 value in it.
>
> If you want a property to be in the main set ("customKeys") AND you want
> that property to be an array, you can't set the individual elements of the
> area IN the set command. You have to modify a local array variable and then
> set the property to that.
>
> In my example above, the value is just "123", but if you want that to be an
> array, it would go like this:
>
> put "ABC" into myCustomPropNameVar
> put "123" into myCustomPropValue[ "x1" ]
> put "456" into myCustomPropValue[ "x2" ]
> set the customKeys[ myCustomPropNameVar  ] of this stack to
> myCustomPropValue
>
> Not the use of the "customKeys" name. If you use array notation in the set
> command for properties, you are messing with sets, not the contents of the
> properties.
>
>  ~ Chris Innanen
>  ~ Nonsanity
>
>
> On Wed, Apr 27, 2011 at 1:38 PM, Glen Bojsza <gbojsza at gmail.com> wrote:
>
> > Hi Mark,
> >
> > The do script produces what I want (myscore should be score in the
> example)
> > though I am still working through your array structure to see if I can
> get
> > the same results... so far no luck.
> >
> > On Wed, Apr 27, 2011 at 11:23 AM, Mark Schonewille <
> > m.schonewille at economy-x-talk.com> wrote:
> >
> > > Hi Glen,
> > >
> > > One of the problems is that testname and testname[student] are
> different
> > > variables. First it is a simple variable, but next it is an array. When
> > you
> > > turn testname into an array, the variable is cleared and as soon as it
> is
> > > cleared testname is parsed as plane text and hence as a property name.
> > >
> > > You might use the "do" variable:
> > >
> > > put 10 into score
> > > put "math" into myVarName
> > > put "set the" && myVarName & "[" & quote & myStudent & quote & "] of
> this
> > > stack to myScore" into myScript
> > > do myScript
> > >
> > > But why would you do this? It is much easier to use a straightforward
> > array
> > > structure by writing the following...
> > >
> > > put the cStudentScores of me into myStudentScoresArray
> > > put "math" into mySubject
> > > put "John" into myStudent
> > > put 10 into myScore
> > > put myScore into myStudentScoresArray[mySubject][myStudent]
> > > set the cStudentScores of me to myStudentScoresArray
> > >
> > > --
> > > Best regards,
> > >
> > > Mark Schonewille
> > >
> > > Economy-x-Talk Consulting and Software Engineering
> > > Homepage: http://economy-x-talk.com
> > > Twitter: http://twitter.com/xtalkprogrammer
> > > KvK: 50277553
> > >
> > > New: Download the Installer Maker Plugin 1.6 for LiveCode here
> > > http://qery.us/ce
> > >
> > > On 27 apr 2011, at 18:27, Glen Bojsza wrote:
> > >
> > > > Hello,
> > > >
> > > > Hopefully someone is still looking at the list while the conference
> is
> > > going
> > > > on...
> > > >
> > > > I want to create a customkey from a variable.
> > > >
> > > > on mouseup
> > > > put "Math" into testname
> > > > set the testname[student] of this stack to score
> > > > end mouseup
> > > >
> > > > this doesn't create the customkey or properties for me but if I don't
> > use
> > > a
> > > > variable it will work?
> > > >
> > > > on mouseup
> > > > set the Math[student] of this stack to score
> > > > end mouseup
> > > >
> > > > I really would like to use a variable so I can automatically create
> the
> > > > customkeys on the fly.
> > > >
> > > > Any suggestions?
> > > >
> > > > regards,
> > > >
> > > > Glen
> > > > _______________________________________________
> > > > use-livecode mailing list
> > > > use-livecode at lists.runrev.com
> > > > Please visit this url to subscribe, unsubscribe and manage your
> > > subscription preferences:
> > > > http://lists.runrev.com/mailman/listinfo/use-livecode
> > >
> > >
> > > _______________________________________________
> > > use-livecode mailing list
> > > use-livecode at lists.runrev.com
> > > Please visit this url to subscribe, unsubscribe and manage your
> > > subscription preferences:
> > > http://lists.runrev.com/mailman/listinfo/use-livecode
> > >
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>



More information about the use-livecode mailing list