list row properties
Doug Easterbrook
doug at artsman.com
Fri Apr 22 14:46:37 UTC 2022
hi Marin:
I see that phil has mentioend that rows always have one line, so thats why $Linecount check is failing.
I have a far more basic question. why do you need to copy the data to a row and then check that? its not something I’d ever needed to do. and it will be counter productive if you decide you want to use a smart list on a whole ton of data (I.e. many rows).
your edit checks, if they are not already, should be in a table class.
the approach is generally like
TableClass.$verify
if isclear($cinst.var1)
calc errormessage as ‘var 1 is empty’
quit method kfalse
end if
if $cinst.var2<10&$cinst.var2>20
calc errormessage as ‘var 2 must be between 10 and 20’
quit method kfalse
end if
quit method ktrue
etc. hopefully this gives you the idea. check ad many variables as you want.
then in your code, before you decide to commit the data to the database.
do list.$definefromSqlclass(TableClass)
fetch your data, turn into smart list mode and do what you need.
after data is changed on the screen, time to verify it
for list.$line from 1 to list.$linecount
do list.$verify(errormessage) returns #F
if flag false
display “line “ $cinst.$line has ‘errormessage’ & tell user to fix it
quit loop
end if
end for
data is now ok
update the database
.
and the advantages are
1) there is no row involved in this at all
2) that you can check one or more lines in the list at the same time
3) you can use the $history notation on the list in the table class $verify to compare current and original values and see if a field changed
4) in the desktop client, you can use. list.var1 and list.var2 as the variables on screen — eliminating any movement of data. just read the list, show it on screen.
I’ve simplified the above to give the general idea. there is no moving of data. just use your smart list.
in real life, we use list to return a list of error messages we can process so we can check many fields at one time.
we also return the field in error so we can set the current field based on the first error. just for the users conveneience.
Doug Easterbrook
Arts Management Systems Ltd.
mailto:doug at artsman.com
http://www.artsman.com
Phone (403) 650-1978
> On April 22, 2022, at 6:55 AM, Martin Obongita via omnisdev-en <omnisdev-en at lists.omnis-dev.com> wrote:
>
> Hi, $Listers,
> I am trying to work with a row to edit data.I select a line in a list and then I assign that selected line to a row.I then check if the row has values in it. I confirm that a line has been selected, using:
>
> If iSelectedDataRow.$linecount
>
> For some reason, the above IF statement returns a kTrue flag even when the list row is empty.How do I check if a ROW is not empty or #null?
>
> I know how to get values from a list, using:
> Do iDataList.id
> But, how do I load data from a list ROW variable?The reason I am asking, I am passing a parameter:
>
> Do iDataListObj.$loadDataRowChildDataList(iDataList,iSelectedDataRow.[iTableClassPrefix]id,iChildTableClassRef) Returns iDataRowChildDataList
>
> But the called method is receiving a #null value for the row named 'id'
> As always, all your KIND helps are appreciated.
> Martin Obongita.
>
>
> _____________________________________________________________
> 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