Notational equivalent of Define list
Grzegorz (Greg) Pasternak
gpasternak at cogeco.ca
Sat Apr 17 15:44:57 UTC 2021
Since it is weekend and I am in the mood ;-)
Let me start with this DML command:
>> Define list {acct,-acct.seq}
I found this interesting as it allows you to define the list by ommitting specific file field from the list definition.
It happens that in this case it is ommitting sequence number field that is burried somewhere in the middle of file class definition (note: one could argue to place the sequence number field at the very first place in the file class definition to satisfy the personal desire for order, but it happens that it is where it is).
This code is used with import data from the text file for the purpose of doing insert and/or update in the datafile.
As we know, the sequence number must be unique.
The source file can have the data but does not necessarily guarantees uniqueness of the sequence number value, as matter of fact the creating party doesn't have to care about it, only the actual data elements are needed. I understand that you can stipulate the "empty" placeholder in the record, but that is an extra step to take and creates potential issue when the placeholder is forgotten.
Once the list is populated you can load from list into CRB and insert without regard to the seq number, Omnis will take care of it if it is not storing any value. If however CRB stores the seq value and the value is also already used then the insert fails.
Now, getting to your next question, why do I even care about DML if "everybody" is using SQL. Well, as you know, being victim of its own success means that there are still apps out there that use DML technology, generate some cash that is hard to ignore, and the solution is fitting the needs.
However, I just happen to work with this code on the SQL side as well. The changes are made to DML Omnis code, go through the converter that generates SQL version of the master library code. The file classes are used to generate schema classes that match the description of all fields used, including sequence number that is converted into long int and remains unique. The import method remains the same as in DML, the source file is loaded into list, then records are inserted into database. Since this particular solution is based on converted code the concept of CRB still remains valid (lists still defined from file class rather than table classes bound to schema classes).
Anyway, having said all the above, I just found it interesting the use of minus <acct.seq> in Define list {acct, -acct.seq} - this is a rather obscure use of Define list.
So I was just wondering if notational equivalent exists for that since I routinely use Do vLst.$define() and don't have to make the list current in reversible block anymore.
Hope this helps.
Greg
> On Apr 16, 2021, at 9:04 PM, Doug Easterbrook <doug at artsman.com> wrote:
>
> out of interest…. why do you need to do this.
>
> its easy enough to ignore a column in a list.
>
>
>
> Doug Easterbrook
> Arts Management Systems Ltd.
> mailto:doug at artsman.com
> http://www.artsman.com
> Phone (403) 650-1978
>
>> On April 15, 2021, at 7:56 AM, Grzegorz (Greg) Pasternak <gpasternak at cogeco.ca> wrote:
>>
>> I have sent this to support but maybe I get quicker response from some of you guys:
>>
>> I can rewrite the following code:
>>
>> Begin reversible block
>> Set current list vLst
>> End reversible block
>> Define list {acct}
>>
>> as:
>>
>> Do vLst.$define('acct')
>>
>> However, how do I rewrite this code:
>>
>> Begin reversible block
>> Set current list vLst
>> End reversible block
>> Define list {acct,-acct.seq}
>>
>> =========
>>
>> Note, the code I would like to re-write as "one liner" notational equivalent defines the list from file class by ommitiing the sequence field name.
>>
>> Greg
>> _____________________________________________________________
>> 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