AW: Record structure to Omnis list structure

Udo Sonnabend | WigaSoft AG U.Sonnabend at wigasoft.ch
Fri Apr 2 07:40:05 UTC 2021


   Hi
   Could not resist ;-).
   Remembered me transposing a matrix in earlier times.
   Did it just for fun.
   Not really readably, but dynamic without SQL-Server
   Happy Easter !
   u.
   Do #L1.$define(#1,#S1,#S2,#S3)
   Do #L1.$add(36102,'Lenght',490,'mm')
   Do #L1.$add(36102,'Width',300,'mm')
   Do #L1.$add(36102,'Height',200,'mm')
   Do #L1.$add(36102,'Weight','1.1','kg')
   Do #L1.$add(36102,'Colour','Red',#NULL)
   Do #L1.$add(36103,'Lenght',500,'mm')
   Do #L1.$add(36103,'Width',300,'mm')
   Do #L1.$add(36103,'Height',225,'mm')
   Do #L1.$add(36103,'Weight','2.0','kg')
   Do #L1.$add(36103,'Colour','Blue',#NULL)
   Do #L1.$add(36104.,'Lenght',600,'mm')
   Do #L1.$add(36104,'Width',350,'mm')
   Do #L1.$add(36104,'Height',225,'mm')
   Do #L1.$add(36104,'Weight','2.5','kg')
   Do #L1.$add(36104,'Colour','Grey',#NULL) ## modified key
   # Do #L1.$sort($ref.c1,kFalse)
   # Transposed List
   Do #L2.$define()
   # Col SKU
   Do #L2.$cols.$add('SKU',kInteger)
   # Cols: kNumber,k1dp
   Do
   #L1.$sendall(#L2.$cols.$add($sendallref.c2,kNumber,k1dp),not(#L2.$cols.
   $findname($sendallref.C2).$ident)&rxpos('^[0-9]?\.[0-9]+',$sendallref.C
   3,kTrue,kFalse,#31))
   # Cols: kInteger,k32bitint
   Do
   #L1.$sendall(#L2.$cols.$add($sendallref.c2,kInteger,k32bitint),not(#L2.
   $cols.$findname($sendallref.C2).$ident)&rxpos('^[0-9]+',$sendallref.C3,
   kTrue,kFalse,#31))
   # Cols: kCharacter
   Do
   #L1.$sendall(#L2.$cols.$add($sendallref.c2,kCharacter),not(#L2.$cols.$f
   indname($sendallref.C2).$ident)&rxpos('^[^0-9]+',$sendallref.C3,kTrue,k
   False,#31))
   # Add Lines and IDs
   Do
   #L1.$sendall(#L2.$line.$assign(#L2.$add($sendallref.c1).$line),$sendall
   ref.C1<>#L2.C1)
   # Fill Fields
   Do #L2.$line.$assign(1)
   Do
   #L1.$sendall(#L2.$line.$assign(#L2.$line+(#L2.c1<>$sendallref.c1))+#L2.
   [$sendallref.C2].$assign($sendallref.c3))
   # Labels
   Do
   #L1.$sendall(#L2.$cols.$findname($sendallref.C2).$name.$assign(con($sen
   dallref.C2,'(',$sendallref.C4,')')),#L2.$cols.$findname($sendallref.C2)
   .$ident&not(isnull($sendallref.C4)))

   WigaSoft AG
   Udo Sonnabend
   Entwickler
   Oberstrasse 222 | Postfach 51 | CH-9014 St. Gallen
   Telefon +41 71 274 51 31 | [1]www.wigasoft.ch |
   [2]U.Sonnabend at wigasoft.ch

   Diese Mitteilung kann persönliche, vertrauliche oder rechtlich
   geschützte Informationen enthalten und ist nur für die Verwendung durch
   den beabsichtigten Empfänger bestimmt. Auf Vertraulichkeit oder Rechte
   wird aufgrund von Fehlübertragungen nicht verzichtet. Wenn Sie nicht
   der beabsichtigte Empfänger dieser Mitteilung sind, dürfen Sie diese in
   keiner Form verwenden, verbreiten oder kopieren. Haben Sie diese
   Mitteilung irrtümlich erhalten, dann löschen Sie diese und allfällige
   Kopien und benachrichtigen Sie bitte unverzüglich den Absender – besten
   Dank.
   P Bitte denken Sie an die Umwelt, bevor Sie dieses Mail drucken. Think
   before print!
   -----Ursprüngliche Nachricht-----
   Von: omnisdev-en [[3]mailto:omnisdev-en-bounces at lists.omnis-dev.com] Im
   Auftrag von IT
   Gesendet: Donnerstag, 1. April 2021 20:43
   An: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
   Betreff: Record structure to Omnis list structure
   Hi,
   I have a select from postgres database that returns records with item
   properties. Every record is a single propertie.
   Something like this:
   item_sku   car_name   laca_value   unca_simbol
   36102        Lenght         490             mm
   36102        Width          300             mm
   36102        Height         200             mm
   36102        Weight         1,1             kg
   36102        Colour         Red            NULL
   36103        Lenght         500             mm
   36103        Width          300             mm
   36103        Height         225             mm
   36103        Weight         2,0             kg
   36103        Colour        Blue            NULL
   36104        Lenght         600             mm
   36104        Width          350             mm
   36104        Height         225             mm
   36104        Weight         2,5             kg
   36102        Colour        Grey            NULL
   I need to convert records structure in a table.
   Extract title columns, and item values to an omnis list
   I need an Omnis list with something like this.
   SKU     Length(mm)     Width(mm)     Height(mm)     Weight(kg)
   Colour
   36102   490            300           200            1,1             Red
   36103   500            300           225            2,0
   Blue
   36104   600            350           225            2,5
   Grey
   The number of properties varies based on product lines.
   Any advice ?
   regards
   xavier
   _____________________________________________________________
   Manage your list subscriptions at [4]http://lists.omnis-dev.com Start a
   new message -> [5]mailto:omnisdev-en at lists.omnis-dev.com

References

   1. http://www.wigasoft.ch/
   2. mailto:U.Sonnabend at wigasoft.ch
   3. mailto:omnisdev-en-bounces at lists.omnis-dev.com
   4. http://lists.omnis-dev.com/
   5. mailto:omnisdev-en at lists.omnis-dev.com


More information about the omnisdev-en mailing list