dgFail

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

dgFail

J. Landman Gay via use-livecode
Hi all.

Given:

on mouseUp
   put the dgDataOfIndex [1] of group "dgPODetail" into aDetailRecord
   put printKeys(aDetailRecord) into tPrintKeys
   set the numberFormat to "0.00"
   put aDetailRecord ["poitemqty"] * aDetailRecord ["poitemunitprice"] into tExtPrice
   put tExtPrice * (aDetailRecord ["poitemdiscount"] /100) into tDiscount
   put tExtPrice -  tDiscount into tItemExtPrice
   put round(tItemExtPrice, 2) into aDetailRecord ["poitemextprice"]  
   put printKeys(aDetailRecord) into tPrintKeys
   put aDetailRecord ["podetailid"] into tpodetailid
   dispatch findIndex to group "dgpodetail" with "podetailid", tpodetailid
   put the result into tDetailIndex
   set the dgDataOfIndex [tDetailIndex] of group "dgPODetail" to aDetailRecord -- NOT WORKING
   put the dgDataOfIndex [1] of group "dgPODetail" into aDetailRecord
   put printKeys(aDetailRecord) into tPrintKeys
end mouseUp

Note the three printKeys() outputs. The first produces a key value pair poitemextprice: 89.99
The second produces a key value pair poitemextprice: 179.98 as it should fter the calculation.

Then I set the dgDataOfIndex [1] (the only record in the datagrid) to the array for that record. The datagrid DOES NOT UPDATE. The third print keys produces poitemextprice: 89.99

This has GOT to be a bug. If anyone wants to try to reproduce this, here are the datagrid params. Enter whatever values you want:

dgProp[columns]
podetailid
poitemqty
vendorpartnumber
poitemdescrip
poitemunitprice
poitemextprice
poitemdiscount

dgProp[column labels]
ID
Qty
Part#
Description
Unit Price
Ext Price
Disc %

dgProp[column widths]
40,40,85,306,100,100,53


Bob S


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: dgFail

J. Landman Gay via use-livecode
LC Business Version 8.1.9 Mac OS X 10.13.3

> On Feb 16, 2018, at 09:40 , Bob Sneidar <[hidden email]> wrote:
>
> Hi all.
>
> Given:
>
> on mouseUp
>   put the dgDataOfIndex [1] of group "dgPODetail" into aDetailRecord
>   put printKeys(aDetailRecord) into tPrintKeys
>   set the numberFormat to "0.00"
>   put aDetailRecord ["poitemqty"] * aDetailRecord ["poitemunitprice"] into tExtPrice
>   put tExtPrice * (aDetailRecord ["poitemdiscount"] /100) into tDiscount
>   put tExtPrice -  tDiscount into tItemExtPrice
>   put round(tItemExtPrice, 2) into aDetailRecord ["poitemextprice"]  
>   put printKeys(aDetailRecord) into tPrintKeys
>   put aDetailRecord ["podetailid"] into tpodetailid
>   dispatch findIndex to group "dgpodetail" with "podetailid", tpodetailid
>   put the result into tDetailIndex
>   set the dgDataOfIndex [tDetailIndex] of group "dgPODetail" to aDetailRecord -- NOT WORKING
>   put the dgDataOfIndex [1] of group "dgPODetail" into aDetailRecord
>   put printKeys(aDetailRecord) into tPrintKeys
> end mouseUp
>
> Note the three printKeys() outputs. The first produces a key value pair poitemextprice: 89.99
> The second produces a key value pair poitemextprice: 179.98 as it should fter the calculation.
>
> Then I set the dgDataOfIndex [1] (the only record in the datagrid) to the array for that record. The datagrid DOES NOT UPDATE. The third print keys produces poitemextprice: 89.99
>
> This has GOT to be a bug. If anyone wants to try to reproduce this, here are the datagrid params. Enter whatever values you want:
>
> dgProp[columns]
> podetailid
> poitemqty
> vendorpartnumber
> poitemdescrip
> poitemunitprice
> poitemextprice
> poitemdiscount
>
> dgProp[column labels]
> ID
> Qty
> Part#
> Description
> Unit Price
> Ext Price
> Disc %
>
> dgProp[column widths]
> 40,40,85,306,100,100,53
>
>
> Bob S
>


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: dgFail

J. Landman Gay via use-livecode
Also printKeys() is a sqlYoga function. If you don't have it remove those lines and breakpoint at end mouseUp to see the contents of the two array keys.

> On Feb 16, 2018, at 09:41 , Bob Sneidar <[hidden email]> wrote:
>
> LC Business Version 8.1.9 Mac OS X 10.13.3
>
>> On Feb 16, 2018, at 09:40 , Bob Sneidar <[hidden email]> wrote:
>>
>> Hi all.
>>
>> Given:
>>
>> on mouseUp
>>  put the dgDataOfIndex [1] of group "dgPODetail" into aDetailRecord
>>  put printKeys(aDetailRecord) into tPrintKeys
>>  set the numberFormat to "0.00"
>>  put aDetailRecord ["poitemqty"] * aDetailRecord ["poitemunitprice"] into tExtPrice
>>  put tExtPrice * (aDetailRecord ["poitemdiscount"] /100) into tDiscount
>>  put tExtPrice -  tDiscount into tItemExtPrice
>>  put round(tItemExtPrice, 2) into aDetailRecord ["poitemextprice"]  
>>  put printKeys(aDetailRecord) into tPrintKeys
>>  put aDetailRecord ["podetailid"] into tpodetailid
>>  dispatch findIndex to group "dgpodetail" with "podetailid", tpodetailid
>>  put the result into tDetailIndex
>>  set the dgDataOfIndex [tDetailIndex] of group "dgPODetail" to aDetailRecord -- NOT WORKING
>>  put the dgDataOfIndex [1] of group "dgPODetail" into aDetailRecord
>>  put printKeys(aDetailRecord) into tPrintKeys
>> end mouseUp
>>
>> Note the three printKeys() outputs. The first produces a key value pair poitemextprice: 89.99
>> The second produces a key value pair poitemextprice: 179.98 as it should fter the calculation.
>>
>> Then I set the dgDataOfIndex [1] (the only record in the datagrid) to the array for that record. The datagrid DOES NOT UPDATE. The third print keys produces poitemextprice: 89.99
>>
>> This has GOT to be a bug. If anyone wants to try to reproduce this, here are the datagrid params. Enter whatever values you want:
>>
>> dgProp[columns]
>> podetailid
>> poitemqty
>> vendorpartnumber
>> poitemdescrip
>> poitemunitprice
>> poitemextprice
>> poitemdiscount
>>
>> dgProp[column labels]
>> ID
>> Qty
>> Part#
>> Description
>> Unit Price
>> Ext Price
>> Disc %
>>
>> dgProp[column widths]
>> 40,40,85,306,100,100,53
>>
>>
>> Bob S
>>
>


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: dgFail

J. Landman Gay via use-livecode
In reply to this post by J. Landman Gay via use-livecode
I think I just figured it out. Remember our discussion about numberFormat? Remember how the SC variable watcher does not honor the numberFormat?? Well when I call findIndex instead of getting 1, I get 1.00!!! CRAP!!! So now I have to reset numberFormat before calling any DG functions!

Bob S



> On Feb 16, 2018, at 09:41 , Bob Sneidar via use-livecode <[hidden email]> wrote:
>
> LC Business Version 8.1.9 Mac OS X 10.13.3
>
>> On Feb 16, 2018, at 09:40 , Bob Sneidar <[hidden email]> wrote:
>>
>> Hi all.
>>
>> Given:
>>
>> on mouseUp
>>  put the dgDataOfIndex [1] of group "dgPODetail" into aDetailRecord
>>  put printKeys(aDetailRecord) into tPrintKeys
>>  set the numberFormat to "0.00"
>>  put aDetailRecord ["poitemqty"] * aDetailRecord ["poitemunitprice"] into tExtPrice
>>  put tExtPrice * (aDetailRecord ["poitemdiscount"] /100) into tDiscount
>>  put tExtPrice -  tDiscount into tItemExtPrice
>>  put round(tItemExtPrice, 2) into aDetailRecord ["poitemextprice"]  
>>  put printKeys(aDetailRecord) into tPrintKeys
>>  put aDetailRecord ["podetailid"] into tpodetailid
>>  dispatch findIndex to group "dgpodetail" with "podetailid", tpodetailid
>>  put the result into tDetailIndex
>>  set the dgDataOfIndex [tDetailIndex] of group "dgPODetail" to aDetailRecord -- NOT WORKING
>>  put the dgDataOfIndex [1] of group "dgPODetail" into aDetailRecord
>>  put printKeys(aDetailRecord) into tPrintKeys
>> end mouseUp
>>
>> Note the three printKeys() outputs. The first produces a key value pair poitemextprice: 89.99
>> The second produces a key value pair poitemextprice: 179.98 as it should fter the calculation.
>>
>> Then I set the dgDataOfIndex [1] (the only record in the datagrid) to the array for that record. The datagrid DOES NOT UPDATE. The third print keys produces poitemextprice: 89.99
>>
>> This has GOT to be a bug. If anyone wants to try to reproduce this, here are the datagrid params. Enter whatever values you want:
>>
>> dgProp[columns]
>> podetailid
>> poitemqty
>> vendorpartnumber
>> poitemdescrip
>> poitemunitprice
>> poitemextprice
>> poitemdiscount
>>
>> dgProp[column labels]
>> ID
>> Qty
>> Part#
>> Description
>> Unit Price
>> Ext Price
>> Disc %
>>
>> dgProp[column widths]
>> 40,40,85,306,100,100,53
>>
>>
>> Bob S
>>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode