$8.1.7.2 and macOS 10.14.6 keeps crashing while debugging
Denis Woodbury
denis at woodmic.net
Fri Jun 5 09:54:23 EDT 2020
Hi,
Of course if you don’t save at every change you lose the code in all classes that was changed.
Wondering if it's just me or this is happening to others ?
And if it does, what's the fix ?
Thanks all
denis woodbury
On 2020-06-05, 8:02 AM, "omnisdev-en on behalf of Rob Mostyn" <omnisdev-en-bounces at lists.omnis-dev.com on behalf of mostyn at platformis.net> wrote:
And a slightly different angle Das… which relies on use of row variables instead of the CRB
Do irCurrent.$fetch_pk() ## re-fetch row from db before editing
calculate irOriginal as irCurrent
then after the uses clicks save:
Do oStringThings.$hasRowBeenModified(irOriginal,irCurrent) returns lbModified
If lbModified
do irCurrent.$update() returns lbOK
if lbOK
Calculate irOriginal as irCurrent
End if
End if
- - - -
If you provide a stateless window (where the data is fetched and all fields are modifiable without clicking on edit button) you can put
Do oStringThings.$hasRowBeenModified(irOriginal,irCurrent) returns ibModified
in the $control of the window On evAfter or evClick
and enable the Save/cancel buttons if ibModified is true.
Cheers,
Rob
The $hasRowBeenModified is available in the object oStringThings in our INFRA project on Git… but here it is in text:
##### Method '$HasRowBeenModified' #####
No. Parameter Type Subtype Init.Val/Calc Description
1 pOrig Row
2 pNew Row
3 pReturnColNames Boolean kFalse
4 pExcludeTheseCols Character 100000000
5 pOnlyTestTheseCols Character 100000000
6 pNullAndEmptyAreSame Boolean kFalse
7 pcOnlyTestColsWithThisPrefix Character 10
No. Local Variable Type Subtype Init.Val/Calc Description
1 lbinNew Binary 100000000
2 lbinOrig Binary 100000000
3 lbModified Boolean
4 lbTestThisCol Boolean
5 lcColName Character 100
6 lcModifiedCols Character 100000000
7 lcValNew Character 100000000
8 lcValOrig Character 100000000
9 lnColCount 32 bit integer
10 lnModifiedColsCount 32 bit integer
# compares two row vars and reports back modified cols
If pExcludeTheseCols<>''
# surrounding comma separated column list with commas allows the efficient test below to work
Calculate pExcludeTheseCols as con(',',pExcludeTheseCols,',')
End If
If pOnlyTestTheseCols<>''
# surrounding comma separated column list with commas allows the efficient test below to work
Calculate pOnlyTestTheseCols as con(',',pOnlyTestTheseCols,',')
End If
For lnColCount from 1 to pOrig.$colcount step 1
Calculate lcColName as pOrig.$cols.[lnColCount].$name()
Calculate lbTestThisCol as kFalse
If pOnlyTestTheseCols<>''
If pos(con(',',lcColName,','),pOnlyTestTheseCols)>0
Calculate lbTestThisCol as kTrue
End If
Else If pExcludeTheseCols<>''
If pos(con(',',lcColName,','),pExcludeTheseCols)>0
Calculate lbTestThisCol as kFalse
Else
Calculate lbTestThisCol as kTrue
End If
Else If pcOnlyTestColsWithThisPrefix<>''
# make sure prefix includes _ delimiter
If pos('_',pcOnlyTestColsWithThisPrefix)=0
Calculate pcOnlyTestColsWithThisPrefix as con(pcOnlyTestColsWithThisPrefix,'_')
End If
If mid(lcColName,1,pos('_',lcColName))=pcOnlyTestColsWithThisPrefix
Calculate lbTestThisCol as kTrue
Else
Calculate lbTestThisCol as kFalse
End If
Else
Calculate lbTestThisCol as kTrue
End If
If lbTestThisCol
Calculate lbModified as kFalse
If pOrig.$cols.[lnColCount].$coltype=kBinary
# we started getting runtime character as binary errors about 10/12/2010
# so this code was added to explicitly handle binary comparisons
Calculate lbinOrig as pOrig.C[lnColCount]
Calculate lbinNew as pNew.C[lnColCount]
Calculate lbModified as not(bincompare(lbinOrig,lbinNew)) ## bincompare() Returns true if they are equal
Else
If pos('JSON',upp(pOrig.C[lnColCount].$name))>0
Calculate lcValOrig as OJSON.$formatjson(pOrig.C[lnColCount])
Calculate lcValNew as OJSON.$formatjson(pNew.C[lnColCount])
Else
Calculate lcValOrig as pOrig.C[lnColCount]
Calculate lcValNew as pNew.C[lnColCount]
End If
If isnull(lcValOrig)&isnull(lcValNew)
# no change
Else If pNullAndEmptyAreSame&len(lcValOrig)=len(lcValNew)&len(lcValNew)=0
# no change
Else If isnull(lcValOrig)¬(isnull(lcValNew))
Calculate lbModified as kTrue
Else If not(isnull(lcValOrig))&isnull(lcValNew)
Calculate lbModified as kTrue
Else If lcValOrig<>lcValNew
Calculate lbModified as kTrue
End If
End If
If lbModified
Calculate lnModifiedColsCount as lnModifiedColsCount+1
Calculate lcModifiedCols as con(lcModifiedCols,pick(lcModifiedCols<>'','',','),lcColName)
End If
End If
End For
If pReturnColNames
Quit method lcModifiedCols
Else
Quit method lnModifiedColsCount
End If
> On 4 Jun 2020, at 22:40, Alex Clay via omnisdev-en <omnisdev-en at lists.omnis-dev.com> wrote:
>
> Hi Das,
>
> I'll echo what others have said that smartlists are a great way to do this, especially if the goal is to push changes to the database.
>
> If you just need to compare data in memory, OmnisTAP has an $is_list assertion that compares two lists. Feel free to re-use the code: https://github.com/suransys/omnistap/blob/master/src/omnistap/OmnisTAP/ogTAPMethods/%24is_list.omh <https://github.com/suransys/omnistap/blob/master/src/omnistap/OmnisTAP/ogTAPMethods/$is_list.omh>
>
> You could also try converting the lists to JSON and doing a simple <> comparison on the resulting text.
>
> Alex
>
>> On Jun 4, 2020, at 13:12, Das Goravani <das at goravani.com> wrote:
>>
>>
>> Hello all
>>
>> Any ideas on “telling if some data has changed” in a complex situation where there are many fields in a file, some rows, that could have changed.. when they close the window.. to be able to tell if something has changed, is there an easy way?
>>
>> How does one track if something has changed.. the hard coded way seems big.. putting code in all places where something could change that tracks if something has.. seems like a big retrofit task
>>
>> I’m wondering if there’s a compare function I’ve overlooked.. or a technique I haven’t thought of
>>
>> Any input appreciated
>>
>> Das
>> _____________________________________________________________
>> Manage your list subscriptions at http://lists.omnis-dev.com
>> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
>
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
_____________________________________________________________
Manage your list subscriptions at http://lists.omnis-dev.com
Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
More information about the omnisdev-en
mailing list