Smartlists and deletes
Doug Easterbrook
doug at artsman.com
Fri Jul 15 22:34:53 UTC 2022
you should use $dowork() which will do the inserts, updates and deletes for you.
Do iLineItemsList.$clear()
Do iLineItemsList.$smartlist.$assign(kFalse)
Do iLineItemsList.$select('WHERE line_inv_id=[iInvRow.inv_id]')
Do iLineItemsList.$fetch(kFetchAll)
Do iLineItemsList.$smartlist.$assign(kTrue)
Set current list iLineItemsList
Select list line(s) (All lines)
Delete selected lines
Do iLineItemsList.$dowork()
a $dowork processes all changes between
Do iLineItemsList.$smartlist.$assign(ktrue)
and
Do iLineItemsList.$smartlist.$assign(kfalse)
so you can
1) fetch a bunch of lines into a list
2) remove a few, lines lines 1 to 4 (note, no smart list yet)
3) set smart list TRUE
4) remove a couple of lines
5) add a line
6) change a line
7) $DOWORK
8) set smart list FALSE
9) add a couple of lines to the list
meaning
the lines you took out of the list in step 2 — WILL NOT be deleted (outside the smart list)
lines removed in step 4 will be deleted (they are inside the smart list)
lines added in step 5 will be inserted (they are inside the smart list)
lines changed in line 6 will be changed (they are inside the smart list)
line added in step 9 WILL NOT be inserted, they are outside the smart list.
or to be even more clear
1) fetch a bunch of lines into a list
2) remove a few, lines lines 1 to 4 (note, no smart list yet)
3) set smart list TRUE
4) remove a couple of lines
5) set smartlist to FALSE
6) setSmartList to TRUE
7) $DOWORK
8) set smart list FALSE
in step 5, I set smart list to false, without a dowork. so anthing removed in line 4 will not be DELETED. since setting smart list false clears the $history list. and the dowork will not see those lines as being there
Doug Easterbrook
Arts Management Systems Ltd.
mailto:doug at artsman.com
http://www.artsman.com
Phone (403) 650-1978
> On Jul 15, 2022, at 1:20 PM, Das Goravani <goravanis at gmail.com> wrote:
>
> This is another way?
>
> Do iLineItemsList.$clear()
> Do iLineItemsList.$smartlist.$assign(kFalse)
> Do iLineItemsList.$select('WHERE line_inv_id=[iInvRow.inv_id]')
> Do iLineItemsList.$fetch(kFetchAll)
> Do iLineItemsList.$smartlist.$assign(kTrue)
> Set current list iLineItemsList
> Select list line(s) (All lines)
> Delete selected lines
> Do iLineItemsList.$dodeletes()
> _____________________________________________________________
> 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