smartlist dowork
Doug Easterbrook
doug at artsman.com
Wed Apr 13 19:41:22 UTC 2022
YES
the @[pCode] syntax is called bind variables.
it takes the curreny $cinst.pCode from the current line in the list and substitures it for @[pCode]
Doug Easterbrook
Arts Management Systems Ltd.
mailto:doug at artsman.com
http://www.artsman.com
Phone (403) 650-1978
> On April 13, 2022, at 12:03 PM, Martin Obongita via omnisdev-en <omnisdev-en at lists.omnis-dev.com> wrote:
>
> Hi, $All,
> The syntax shown below inserts data into a postgres table:
> insert into s01_sysreflocal_pry (s01_class,s01_value_label,s01_value,s01_name) values('PasswordPref','Default Password','PasswordParameters_DefaultPassword','access');
> In Omnis, the SQL statement as shown below inserts data into a Postgres server successfully(a different table):Begin statement
> Sta:Insert into c05_countries_pry (c05_code,c05_name,c05_active_from,c05_active_to,c05_activestatus_linenum,c05_economicregion_linenum,c05_picture_flag)
>
> Sta:Values (@[pCode], @[pColName], @[pActiveFrom], @[pActiveTo], @[pActivestatusLinenum], @[pEconomicregionLinenum],@[pPictureFlag])
>
> End statement
>
> Does the above SQL statement also apply to $smartlist $dowork method $save "$cinst.$update($cinst)" ?
> Rgds, Martin.
>
>
> On Wednesday, April 13, 2022, 12:02:01 AM GMT+3, Martin Obongita via omnisdev-en <omnisdev-en at lists.omnis-dev.com> wrote:
>
> Hi Das,You said, "So I capture the row being used in Find, Select, List selection, any read in of a record, I capture the name of that table vis the row I use for it.. "
> I have schema named s01_sysreflocal_pry and table class taSysRefLocal.
> How do I capture task var "tvLastRowUsed"?By capture do you mean to define the row as that table class?
> Rgds, Martin.
>
>
>
> On Tuesday, April 12, 2022, 09:01:58 PM GMT+3, Das Goravani <goravanis at gmail.com> wrote:
>
> $cinst.$update($cinst)
>
> In theory that command should work, but I found that theory didn’t pan out.
>
> I may have been misled by some other things, but I found in my work that $cinst didn’t always work. I had to go to putting a variable there that contains the name of the row being used, instead of $cinst
>
> So I capture the row being used in Find, Select, List selection, any read in of a record, I capture the name of that table vis the row I use for it.. and use that row when updating that record instead of $cinst
>
> Do [tvLastRowUsed].$update()
>
> (I did ALL my inserting, updating, deleting, via centralized code that is called from everywhere.. so I never knew which table was being used and had to have everything working on the premises that any table could come through there.. I did things that way.
>
> tvLastRowUsed is a task variable for greatest scope, and it contains the name of the row that is being used to hold a tables data, is related therefore by name to the table class being used, which uses what is in the master table super class code wise. So it is in the master table class that I put the real code that is run. You probably know and do this already.
>
> Don’t know if I’m crazy or not but I found $cinst didn’t always work right. In my desktop app which uses SQLite, I have a mixed arrangement now.. some with the name field and some using $cinst and it works out.
>
> I also capture the old row at the end of Finds, Selects, Read-Ins.. and save it after Inserts and Updates.. it is the OLD row when the NEXT update on it comes around.. I like knowing I have the actual old row in there. I know however that usually it only uses the Primary Key field from old row.. making having the actual old row not necessary, but I do it anyways.
>
>
>
>> On Apr 12, 2022, at 1:38 PM, Martin Obongita via omnisdev-en <omnisdev-en at lists.omnis-dev.com> wrote:
>>
>> Hi Das,I sent them my library on the issue of $dowork, and they couldn't figure out why the method $save Do $cinst.$update($cinst) Returns #Fwas returning a false flag.So they left me with, we will get back to you when we find a solution.
>> Martin
>>
>>
>> On Tuesday, April 12, 2022, 08:15:18 PM GMT+3, Das Goravani <goravanis at gmail.com> wrote:
>>
>>
>> Martin,
>>
>> I haven’t worked with smart lists much. When I did, I also had some trouble getting it right, getting it to work, but eventually was able to do so and I agree, smart lists are really cool..
>>
>> I don’t know a slick way to test if a data connection is still active. I myself look at the SQL Browser in the Browser to see if the connection is still showing there (with sub lines like "Tables"..) written underneath the connection name. That tells me it’s still active. Sometimes I click on tables and make sure they are all listed to make sure my data connection is still valid. I code to verify I have a connection I
>>
>> Clear a row
>> Do a select that should populate that row
>> Test if data is in the row just by If myVar =1 (a certain column should have a 1 in it)
>>
>> If I am able to fetch that record into that row then I have a valid data connection
>>
>> So I actually test in that way sometimes.
>>
>> There may be much slicker ways of testing if a data connection is up and running.
>>
>> From what I’ve read on here you are doing what is necessary to make smart lists work.
>>
>> I would agree with others who say that you should test if your data is happening.. make sure $insert and $update work, or one of them, then try the smart list.
>>
>> Smart lists are essentially simple.. they keep track of changes made to a table that they can easily represent in memory, or part of a table.
>>
>> You add lines, change lines, remove lines, and it remembers these things and "does" these changes to your data table with the "$do…" commands like $dowork()
>>
>> That’s it. There’s nothing more to them.
>>
>> When I saw your code, a long piece, posted earlier in this thread, I got concerned about other things in it, and urged you to step through it and make sure it is stepping onto the lines you wanted.. but that piece of code was a manual approach to what the dowork command does automatically.. so I would recommend the $dowork command instead.
>>
>> Something else you said recently was cause for concern.. when you described what you are now doing.. why $excludefromupdate wasn’t needed.. I think it’s always needed with Postgres.. excluding the primary key from the columns submitted with either insert or update. I thought from what I’ve learned that this is always needed with postgres.
>>
>> I myself am connected to postgres now having successfully set it up on servers, learned how to use pgAdmin and so forth.. Postgres is my database now.. but I have not coded a lot with it yet.. I have yet to make my much used central called insert and update routines have the workings that postgres requires.. so I’m not that authoritative on postgres yet..
>>
>> Hoping you find a way to make smart lists work. It may be in reducing the amount of code you use with them.. they are essentially really simple.
>>
>> All the best to you,
>>
>> Das Goravani
>>
>> Ps: I’m surprised Omnis support has given up on you on this. That’s surprising to hear. I once had a problem, with updating, and it was Jeramy who was helping me.. and he stayed until it was resolved. It turns out I was using not a real row variable to represent "old row" to the $update command.. everything looked right at first glance, but in fact I was using a character variable to hold the name of old row, I wasn’t passing an actual row variable.. we went around on other things for a long time and came back to this simple point which was the clincher.. so in the end it may turn out to be a really small thing that is stopping you..
>>
>> Verify that data is working.. then try issuing the smart list commands, they should work straight away
>>
>> Here’s to believing that bumble bees can fly and that Martin will get smart lists working !!!!
>>
>>
>> _____________________________________________________________
>> 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