smartlist dowork

Das Goravani goravanis at gmail.com
Tue Apr 12 16:02:38 UTC 2022


Martin,

I assume you know this but there is a single command that does the updates and inserts, and deletes, 

And it is 

mySmartList.$dowork()

That single command does it all.. it uses the status in the list for each line, and does the appropriate work either insert, or update, or delete. All the actions that designate what a line is have to take place AFTER you declare it as a smart list. It then stores what has happened to each line. New lines are inserts, updated lines are update, deleted lines are delete. Naturally, it uses the history list to determine such things. 

There are also $doinserts(), $doupdates() and $dodeletes() which do the work they are named for so that you can control when inserts, and updates, and deletes take place. 

If there is a lot of work to be done naturally it takes a small amount of time for these commands to work. 

Naturally you have to have a connection, and your log on objects, in place and having blessed the smart list so that it becomes a SQL list. 

Hope that helps,

Das Goravani



> On Apr 12, 2022, at 11:54 AM, Rudolf Bargholz <rudolf at bargholz.ch> wrote:
> 
> Hi Martin,
> 
> Perhaps the following can help.
> 
> http://www.studiotips.net/docs/tips_sql/smartlists/all.html
> 
> Regards
> 
> Rudolf
> 
> -----Ursprüngliche Nachricht-----
> Von: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> Im Auftrag von Martin Obongita via omnisdev-en
> Gesendet: Dienstag, 12. April 2022 17:51
> An: Martin Obongita via omnisdev-en <omnisdev-en at lists.omnis-dev.com>
> Cc: Martin Obongita <martin.obongita at yahoo.com>
> Betreff: Re: smartlist dowork
> 
> Hi all,        I have looked in the hub for sample libraries that could show how to insert or update a smartlist.        I didn't seem to find any.        Does anyone here have a snippet on how to insert and/or update a smartlist?        Kind regards, Martin O.
> 
> 
>    On Monday, April 11, 2022, 10:58:58 PM GMT+3, Martin Obongita via omnisdev-en <omnisdev-en at lists.omnis-dev.com> wrote:  
> 
>  Hi Das,
> Thanks for your ideas.
> I have a remote task rtMonirot that logs to postgres server and then creates a session.An error is returned if the session is null.
> How do I check that the session is still logged on when I am updating a smartlist?
> Rgds,
> 
>     On Monday, April 11, 2022, 08:39:08 PM GMT+3, Das Goravani <goravanis at gmail.com> wrote:  
> 
> The fact that your button event returns flag true is not relevant given you’re not returning the flag out of your save method, and that last .$next() may return a flag and thus mislead you. So forget that flag.
> 
> Not updating database… your code is pretty simple, so the suspect part is clear to see.. 
> 
> Have you stepped through it with good sample data in list with some changes or inserts
> 
> Did if fork to your save method like it’s supposed to
> 
> Did it surely step over the update and insert commands?
> 
> If it did and no data was update/inserted then you have to wonder about your connection
> 
> Which goes to are you surely logged on
> Do you have thus your log on objects, statement and other...
> And you’re putting other into this list
> Thus blessing it with abilities to update data Blessing it with connection to the data
> 
> If those things aren’t in place and active then data won’t update
> 
> Sorry I temporarily forgot the names of things, I haven’t coded lately.. 
> 
> I don’t know why but I found sometimes $cinst didn’t work right, and I had to go to putting in the list name in a variable in square brackets where $cinst goes, but I hope that is not the case for you and that it works as it should
> 
> 
>> On Apr 11, 2022, at 8:08 AM, Martin Obongita via omnisdev-en <omnisdev-en at lists.omnis-dev.com> wrote:
>> 
>> Hi All
>> I am trying to update a smartlist with the following methods:
>> btnUpdate: $event
>> Do iOrgGeneralPrefList.$dowork() Returns #F
>> 
>> taSuperTable: $dowork
>> Do $cinst.$first()
>> 
>> While $cinst.$line>0
>> 
>> Switch $cinst.$status
>> 
>> Case kRowDeleted
>> 
>> Do $cinst.$delete()
>> 
>> Case kRowInserted,kRowUpdated
>> 
>> Do $cinst.$save()
>> 
>> End Switch
>> 
>> Do $cinst.$next()
>> 
>> End While
>> 
>> Quit method #F
>> 
>> taSuperTable: $save
>> If $cinst.[iPrimaryKeyName]>0 ## already primary key value
>> 
>> Do $cinst.$update($cinst) Returns #F
>> 
>> Else
>> 
>> Do $cinst.$insert() Returns #F
>> 
>> End If
>> 
>> The flag in the btnUpdate $event returns kTrue.        But the changes 
>> in the smartlist are not updating the table in the database. Where in my code am I going off the rails?
>> As always, I appreciate all your kind helps.
>> Martin.
>> _____________________________________________________________
>> Manage your list subscriptions at https://lists.omnis-dev.com Start a 
>> new message -> mailto:omnisdev-en at lists.omnis-dev.com
> 
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 
>   
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 
> 
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 



More information about the omnisdev-en mailing list