Getting a single column of a datagrid
Bob Sneidar
bobs at twft.com
Mon May 14 11:45:28 EDT 2012
It came from Trevor that way. I had to clean it up as well. It works though. I used this technique to create my own kind of printKeys function. Instead of breaking out each key as a line in the text, and then the value as key:value, I create a single line for each key with a value, and then I bracket all the key names to distinguish them from the value. This has several advantages. I can now filter the result by any of the keys. I can also reconstruct the array after the filtering is done so I can effectively filter an array. Pretty handy at times.
Let me know if you want those functions as well.
Bob
On May 12, 2012, at 7:27 AM, Peter M. Brigham, MD wrote:
> Thanks, Bob.
>
> BTW, don't know why but as you can see your LC scripts tend to have asterisks bracketing keywords, not to mention extra blank lines. Are you pasting formatted text that's getting mis-translated?
>
> I can clean this up and try it out, thanks again.
>
> -- Peter
>
> Peter M. Brigham
> pmbrig at gmail.com
> http://home.comcast.net/~pmbrig
>
>
> On May 10, 2012, at 5:48 PM, Bob Sneidar wrote:
>
>>> *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
>>
>
>
> _______________________________________________
> 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