Use of dgIndex
Michael Doub
mike at doub.com
Mon Nov 7 20:25:49 EST 2011
I think both methods will work. I was having problems with dgLine as well so I found that dgIndexes returns the indexes in the order that they were displayed. So itemOffset is essentially returning dgLine.
I am not sure that you can assume that dgIndex of me = 1 is equivalent to dgLine of me = 1. So I think the line:
If the dgindex of me = 1 then
needs to be:
If myPosition of me = 1 then
or
if the dgLine of me = 1 then
What is the procedure to cut and paste a script into email? On my initial email I tried to paste the script below and it go rejected because it was too large. It did remain colorized so I assumed that it was all of the html tags that push it over the limit of the list.
BTW thanks for all of the help folks.
-= Mike
On 2011-11-07, at 7:56 PM, Mike Bonner wrote:
> ah, I betcha I know what it is. I italicised the script portion and bet
> whatever client you use doesn't recognize it. Either way, heres the script
> again no italics.
>
> on FillInData pDataArray
> put empty into fld "DLabel" of me
> if pDataArray["FirstName"] is not empty then
> put pDataArray["FirstName"] & space after fld "DLabel" of me
> end if
> if pDataArray["MiddleName"] is not empty then
> put pDataArray["MiddleName"] & space after fld "DLabel" of me
> end if
> put pDataArray["LastName"] after fld "DLabel" of me
> put char 1 of fld "DLabel" of me into fld "HLabel" of me
> set the vis of fld "HLabel" of me to false
> set the vis of graphic "HBackground" of me to false
> put the dgControl of me into theGrid
> put the dgIndex of me into tindex
> if tindex is empty then
> put "error" into fld "HLabel" of me
> set the vis of fld "HLabel" of me to true
> set the vis of graphic "HBackground" of me to true
> else
> put the dgIndexes of theGrid into tlist
> set itemdel to comma
> put itemOffset(tindex,tlist) into myPosition
> If the dgindex of me = 1 then
> -- we have the first item so show a header
> set the vis of fld "HLabel" of me to true
> set the vis of graphic "HBackground" of me to true
> else
> put the dgline of me - 1 into previousIndex
> --item (myPosition -1) of tlist into previousIndex
> put the dgDataOfline[previousIndex] of me into theotherdata
> put theotherdata["firstName"] & return after msg
> if the first char of theotherdata["FirstName"] <> the first char
> of pDataArray["FirstName"] then
> -- we found a break so show a header
> set the vis of fld "HLabel" of me to true
> set the vis of graphic "HBackground" of me to true
> end if
> end if
> end if
> end FillInData
>
> On Mon, Nov 7, 2011 at 5:54 PM, Mike Bonner <bonnmike at gmail.com> wrote:
>
>> Hmm. its just gmail and they weren't and aren't there when I paste. As far
>> as I know gmail doesn't do this so i'm not sure where they came from.
>>
>> On Mon, Nov 7, 2011 at 5:49 PM, Peter M. Brigham, MD <pmbrig at gmail.com>wrote:
>>
>>> On Nov 7, 2011, at 7:00 PM, Mike Bonner wrote:
>>>
>>>> ...<snip>
>>>>
>>>> *on FillInData pDataArray*
>>>> * put empty into fld "DLabel" of me*
>>>> * if pDataArray["FirstName"] is not empty then *
>>>> * put pDataArray["FirstName"] & space after fld "DLabel" of me*
>>>> * end if*
>>>> * if pDataArray["MiddleName"] is not empty then *
>>>> * put pDataArray["MiddleName"] & space after fld "DLabel" of me*
>>>> * end if*
>>>> * put pDataArray["LastName"] after fld "DLabel" of me*
>>>> * put char 1 of fld "DLabel" of me into fld "HLabel" of me*
>>>> * set the vis of fld "HLabel" of me to false*
>>>> * set the vis of graphic "HBackground" of me to false*
>>>> * put the dgControl of me into theGrid*
>>>> * put the dgIndex of me into tindex*
>>>> * if tindex is empty then *
>>>> * put "error" into fld "HLabel" of me*
>>>> * set the vis of fld "HLabel" of me to true*
>>>> * set the vis of graphic "HBackground" of me to true*
>>>> * else*
>>>> * put the dgIndexes of theGrid into tlist*
>>>> * set itemdel to comma*
>>>> * put itemOffset(tindex,tlist) into myPosition*
>>>> * If the dgindex of me = 1 then *
>>>> * -- we have the first item so show a header*
>>>> * set the vis of fld "HLabel" of me to true*
>>>> * set the vis of graphic "HBackground" of me to true*
>>>> * else*
>>>> * put the dgline of me - 1 into previousIndex*
>>>> * --item (myPosition -1) of tlist into previousIndex*
>>>> * put the dgDataOfline[previousIndex] of me into theotherdata*
>>>> * put theotherdata["firstName"] & return after msg*
>>>> * if the first char of theotherdata["FirstName"] <> the first
>>> char
>>>> of pDataArray["FirstName"] then*
>>>> * -- we found a break so show a header*
>>>> * set the vis of fld "HLabel" of me to true*
>>>> * set the vis of graphic "HBackground" of me to true*
>>>> * end if*
>>>> * end if*
>>>> * end if*
>>>> *end FillInData*
>>>
>>> I'm curious, is there something in your email client, or in the
>>> copy-from-script-and-paste-into-email process that puts the asterisks
>>> before and after each line? It makes it hard to copy and paste such scripts
>>> to use them. Just wondering....
>>>
>>> -- Peter
>>>
>>> Peter M. Brigham
>>> pmbrig at gmail.com
>>> http://home.comcast.net/~pmbrig
>>>
>>>
>>> _______________________________________________
>>> 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