Getting a single column of a datagrid

Trevor DeVore lists at mangomultimedia.com
Mon Mar 21 23:56:06 EDT 2011


On Mon, Mar 21, 2011 at 8:18 PM, Bob Sneidar <bobs at twft.com> wrote:

>
> It would be nice if printkeys() was public domain but I don't think it is.
> Still, sqlYoga is a good investment anyways. Heck I might have paid what he
> charges for sqlYoga just for that function! ;-)
>

Here you go :-)


/**
 * \brief Returns all dimensions of an array in a text format.
*
* \param @pArray The array to print.
* \param pDimension The dimensions of the array to start printing. Pass in
empty in most cases.
* \param pFullData Pass in true if you want to print off entire value of
each key. By default only one lines is printed.
*
* \return Text
*/

*function* PrintArray @pArray, pDimension, pFullData

   *if* pDimension is empty *then* *put* 0 into pDimension



   *put* the keys of pArray into theKeys

   *sort* theKeys numeric



   *repeat* for each line theKey in theKeys

      *if* pArray[theKey] is an array *then*

         *put* _printCharXTimes(space, pDimension * 5) & theKey & cr
aftertheText

         *put* pArray[theKey] into theTempArray

         *put* PrintArray(theTempArray, pDimension + 1, pFullData) aftertheText

      *else*

         *if* pFullData *then*

            *put* _printCharXTimes(space, pDimension * 5) &  theKey & ":" &&
pArray[theKey] & cr after theText

         *else*

            *put* _printCharXTimes(space, pDimension * 5) &  theKey & ":" &&
line 1 of pArray[theKey] & cr after theText

         *end* *if*

      *end* *if*

   *end* *repeat*



   *return* theText

*end* PrintArray



*private* *function* _printCharXTimes pChar, pTimes

   *local* theStr



   *repeat* with i = 1 to pTimes

      *put* pChar after theStr

   *end* *repeat*

   *return* theStr
*end* _printCharXTimes

-- 
Trevor DeVore
Blue Mango Learning Systems
ScreenSteps: http://www.screensteps.com
LiveCode Resources for Developers: http://livecode.bluemangolearning.com



More information about the use-livecode mailing list