AW: File Format fields order

Rudolf Bargholz rudolf at bargholz.ch
Tue Sep 28 15:34:40 UTC 2021


Hi Das,

Why do you not just define a list from the SQL class, and then use MySqlClassRow.$assignrow(MyFileRow,kTrue) to copy the values from the File based row to the Schema based row variable. The kTrue as the second parameter will match the column names, so if the names in your Schema match those in the File Format, then the copy ought to work fine. I would not use a redefine in this case, just two rows, defined from two different objects. And the order of the fields in this case would also not be relevant due to the second parameter of the $assignrow().

Regards

Rudolf Bargholz

-----Ursprüngliche Nachricht-----
Von: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> Im Auftrag von Das Goravani
Gesendet: Dienstag, 28. September 2021 17:00
An: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
Betreff: Re: File Format fields order


One reason to have Schemas and File Classes in the same field order is this:

You select a row using SQL and it’s in a list defined by the schema names, and although they match your file class names they will NOT read into them in the CRB… so how to get your data from a Schema defined list into your file class fields>?

Simply redefine the list using the matching File Class and IF your fields are in identical order then they are placed in the right File Class fields right then with just the redefine command.  This is priceless. 

Also, but not requiring same order between Schema and FC:

I use matching File Classes against Schemas in another way.. I do all my work in File Fields, then when it’s time to save or retrieve a record, a row, I do that with SQL, so then the row is in a Schema defined row, and to get them to File fields one could redefine the row, but since there is a bug in Omnis if you have a really long complex row where redefining causes corruption, so I move data from the row to the MOFF fields via a quick repeat loop.. same for moving from File fields to SQL row.. just the other direction.. this doesn’t take much time, for this they don’t have to be in the same order since they are addressed by name individually as the repeat loop spins the data into or out of the SQL list

There is no way to easily reorder File Class fields once they are in place.. except the following comes to mind:

Create a temporary File Class that is a copy of the one you want to reorder.. then put an X in front of each field name, then use Find and Replace to find each field one at a time, and change them to the X field instead.. all your code and everything will be re routed to the X field.. then reorder your File Class.. then do Find and Replace again on each and put them back from X field to real field. Thus all your code will be back on the right fields. This is assuming you do NOT have DF1 data linked to the File Classes.. only code. 

That method is part manual and thus troublesome unless you have a low amount of Fields and file classes you need to reorder. 

You all probably know all this. I’m sorry.


_____________________________________________________________
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