Style Question

Pete pete at mollysrevenge.com
Wed Nov 2 15:58:21 EDT 2011


Hi Michael,
I'm not sure I completely understand what you want to do but here's a few
thoughts anyway!

If you want to define constants to refer to item numbers within a delimited
string, you can define globals for each item number and initialise them to
their values somewhere in your application startup script.  This requires
that you declare those globals in every script that refers to them (just
their names, not the values). And yes, an include file function would be
great! Alternatively, you might be able to centralise your data handling in
a single script and make calls to handlers in it, but tough to know if that
would work withoout more info.

If you're using an SQL database, you can eliminate the need to reference
elements of the returned data by element number by using revQueryDatabase.
 It creates a recordset without returning any data directly to you.  You
then use the revMoveTo.... series of calls to navigate through the records
in the recordset.  revDatabaseColumnNamed will return the value of a named
column from the current record in the recordset so you don't have to be
concerned with knowing where in the record the column occurs.


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




On Wed, Nov 2, 2011 at 12:20 PM, Michael Doub <mike at doub.com> wrote:

> I am working on a project that is going to manipulating records of data.
>  What is the best approach to identifying the individual components for use
> in different scripts?
>
> If the data was represented as some delimited string, then each item could
> be defined as a constant.  The question would then be how to manage these
> constants in multiple scripts.  I have not found any references to include
> files, which was my first thought.
>
> if the data was represented in an array these solves the ability to
> reference the items easily enough but then I assume that you would have to
> create some special code to format the code in the correct order for
> consistent input or output ordering
>
> I see when using SQL there is an option of identifying each data element
> separately, but if you use the array syntax you seem to have the same
> problem as a delimited string where you need to define constants to define
> element  numbers.
>
> Can anyone provide any sage wisdom from the school of hard knocks?
>
> Thanks
>   Mike
>
>
>
>
> _______________________________________________
> 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