And if anybody's interested, the code now works like this:
$t:="<CellStyle:"+tTableCellStyleOverride+">"
*Case of* // 04/10/19
*:* ($hbf="h")
*If* (ptra2tCellStylesHeader->{$row}{$ElementOrder}#$t)
ptra2tCellStylesHeader->{$row}{$ElementOrder}:=$t
*End if*
*:* ($hbf="b")
*If* (ptra2tCellStylesBody->{$row}{$ElementOrder}#$t)
ptra2tCellStylesBody->{$row}{$ElementOrder}:=$t
*End if*
*:* ($hbf="f")
*If* (ptra2tCellStylesFooter->{$row}{$ElementOrder}#$t)
ptra2tCellStylesFooter->{$row}{$ElementOrder}:=$t
*End if*
*End case*
On Fri, 4 Oct 2019 at 23:22, Pat Bensky <[email protected]> wrote:
> Fixed it!
> This is what was happening ...
> The array ptra2tCellStylesHeader-> has two rows x 7 columns.
> So after the second iteration, the first Case option
> *:* (($hbf="h") & (ptra2tCellStylesHeader->{$row}{$ElementOrder}#$t))
>
> is erroneous because $row>2. So rather than give an error, it just skips
> through the whole Case statement. I've installed an error handler now :)
>
> Pat
>
>
>
> On Fri, 4 Oct 2019 at 23:06, Pat Bensky <[email protected]> wrote:
>
>> Good suggestion Tim. I tried that but I am still getting bizarre results.
>> This is what I'm doing:
>>
>> 225 $t:="<CellStyle:"+tTableCellStyleOverride+">"
>>
>> 226 $t2:=ptra2tCellStylesBody->{$row}{$ElementOrder}
>>
>> 227 *Case of* // 04/10/19
>>
>> 228 *:* (($hbf="h") & (ptra2tCellStylesHeader->{$row}{$ElementOrder}#$t))
>>
>> 229 ptra2tCellStylesHeader->{$row}{$ElementOrder}:=$t
>>
>> 230 //: (($hbf="b") & (ptra2tCellStylesBody->{$row}{$ElementOrder}#$t))
>>
>> 231 *:* (($hbf="b") & ($t2#$t))
>>
>> 232 ptra2tCellStylesBody->{$row}{$ElementOrder}:=$t
>>
>> 233 *:* (($hbf="f") & (ptra2tCellStylesFooter->{$row}{$ElementOrder}#$t))
>>
>> 234 ptra2tCellStylesFooter->{$row}{$ElementOrder}:=$t
>>
>> 235 *End case*
>>
>>
>> The Expression window shows that:
>>
>> $t="<CellStyle:gray fill>"
>>
>> $t2=""
>>
>> ptra2tCellStylesBody->{$row}{$ElementOrder}=""
>>
>> ($hbf="b")=True
>>
>> ($t2#$t)=True
>>
>> (($hbf="b") & ($t2#$t))=True
>>
>>
>> So it should pop into line 232. But it doesn't. It pops out of the Case
>> statement to line 236.
>>
>> Screen shot here:
>>
>> https://www.dropbox.com/s/roryl0rykuohd8k/4D004.png?dl=0
>>
>>
>> Very confusing!
>>
>> And annoying :)
>>
>>
>> Pat
>>
>>
>>
>>
>> On Fri, 4 Oct 2019 at 20:22, Tim Nevels via 4D_Tech <[email protected]>
>> wrote:
>>
>>> On Oct 4, 2019, at 2:00 PM, Pat Bensky wrote:
>>>
>>> > So the first 2 times through, when $hbf="b" and
>>> ptra2tCellStylesBody->{$row}{$ElementOrder}#$t, it populates the cell:
>>> > ptra2tCellStylesBody->{$row}{$ElementOrder}:=$t
>>> >
>>> > Subsequently, it just pops through the Case statement and doesn't
>>> populate
>>> > the cell, even though those 2 test are both True.
>>> >
>>> > In all cases the two tests evaluate to True.
>>> > What can't I see?
>>>
>>> Maybe the 4D interpreter is getting confused with the rather complex 2D
>>> array pointer thing "ptra2tCellStylesBody->{$row}{$ElementOrder}#$t”
>>> expression. You might try setting a simple boolean variable before the case
>>> statement and see if that makes it work.
>>>
>>> $theThing_b:=(ptra2tCellStylesBody->{$row}{$ElementOrder}#$t)
>>>
>>> Tim
>>>
>>> *****************************************
>>> Tim Nevels
>>> Innovative Solutions
>>> 785-749-3444
>>> [email protected]
>>> *****************************************
>>>
>>> **********************************************************************
>>> 4D Internet Users Group (4D iNUG)
>>> Archive: http://lists.4d.com/archives.html
>>> Options: https://lists.4d.com/mailman/options/4d_tech
>>> Unsub: mailto:[email protected]
>>> **********************************************************************
>>
>>
>>
>> --
>> *************************************************
>> CatBase - Top Dog in Data Publishing
>> tel: +44 (0) 207 118 7889
>> w: http://www.catbase.com
>> skype: pat.bensky
>> *************************************************
>>
>
>
> --
> *************************************************
> CatBase - Top Dog in Data Publishing
> tel: +44 (0) 207 118 7889
> w: http://www.catbase.com
> skype: pat.bensky
> *************************************************
>
--
*************************************************
CatBase - Top Dog in Data Publishing
tel: +44 (0) 207 118 7889
w: http://www.catbase.com
skype: pat.bensky
*************************************************
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive: http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************