[NEWSboard IBMi Forum]

Hybrid View

  1. #1
    Registriert seit
    Jan 2007
    Beiträge
    189
    It's too late in the afternoon to translate this into German

    Have you maybe read this article? SQL: Made to Order.

    This is the Article published in the July 2009 edition iSeries Nation Network newsletter. The original article can be found in the Tekkie-Corner (Chapter 3) at http://www.sss-software.de/inn/power...-PowerInfo.pdf
    The above link does not work anymore, but you can still access it here SQL: Made to Order. (with some extra info as well**).

    IMO, using too many "case when" statements makes the statement hard to maintain for the next developer (as you have found). In your example I would definitely use traditional dynamic SQL (at the cost of a slight performance hit) and build the statement into a string.

    **For example, you can put your sort sequences into a file and simply fetch the sequence needed. This means should you have a new sequence option, you add it to the file and don't need to even change the program anymore.

    Hope this helps.
    mfg

    Kit
    www.ecofitonline.com
    DeskfIT - ChangefIT - XrefIT

  2. #2
    Registriert seit
    May 2005
    Beiträge
    103
    Thank you for your article.

    I have to admit that it's getting complex, but until today I used different SQL-Statements for each accumulation criterion and therefore only one criteria could be used at the same time.

    Since I wanted to offer our users more possibilities it's necessary to have a dynamic statement.
    IMO, the current statement is not too complex (furthermore I'm the only programmer in our team who is able to code RPGIV and SQL ).

    In the meantime I've helped myself by arranging the "order by" criterias in a common way, which works in 99% of upcoming cases.

    Thanks again and have good remainder of the day.

    -- Tobias

  3. #3
    Registriert seit
    Feb 2001
    Beiträge
    20.695
    Für die Sortierung brauchst du Namen und keine Konstanten.
    Dienstleistungen? Die gibt es hier: http://www.fuerchau.de
    Das Excel-AddIn: https://www.ftsolutions.de/index.php/downloads
    BI? Da war doch noch was: http://www.ftsolutions.de

  4. #4
    Registriert seit
    May 2005
    Beiträge
    103
    Ja... hab' mich nun auch damit abgefunden.
    Aber wie oben schon beschrieben, habe ich nun eine passable Lösung für 99% der Fälle. Sollte ein Benutzer die Konstellation für das eine Prozent erwischen, dann muss er sich halt in Excel die Darstellung optimieren

    Dankeschön und einen erholsamen Feierabend.

    -- Tobias

  5. #5
    Registriert seit
    Mar 2002
    Beiträge
    5.365
    ... das ist doch mit dynamic SQL kein Hexenwerk. Du hast bereits eine fixe Tabellenstruktur mit allen potentiellen Feldern in die du eine Variable Struktur mapst, indem du die nicht belegbaren Felder mit Konstanten belegst. Jetzt brauchst du nur noch das SQL Statement für den Insert, das du dir in deinem Programm zusammen baust, inklusive dem order by, ohne das ganze case Gedöns, das macht die Programmlogik - und dieses zusammengebastelte Statement schickst du mit execute gegen die Datenbank und das wars. Warum mit aller Gewalt so kompliziert?

    D*B

    Zitat Zitat von Tobse77 Beitrag anzeigen
    Ja... hab' mich nun auch damit abgefunden.
    Aber wie oben schon beschrieben, habe ich nun eine passable Lösung für 99% der Fälle. Sollte ein Benutzer die Konstellation für das eine Prozent erwischen, dann muss er sich halt in Excel die Darstellung optimieren

    Dankeschön und einen erholsamen Feierabend.

    -- Tobias
    AS400 Freeware
    http://www.bender-dv.de
    Mit embedded SQL in RPG auf Datenbanken von ADABAS bis XBASE zugreifen
    http://sourceforge.net/projects/appserver4rpg/

Similar Threads

  1. Hilfe! Rollback bei Transaktionen funktioniert nicht
    By remo2010 in forum IBM i Hauptforum
    Antworten: 2
    Letzter Beitrag: 23-11-06, 13:31
  2. Authorization Problem nach ändern der Primary Group
    By ChrisX in forum IBM i Hauptforum
    Antworten: 1
    Letzter Beitrag: 11-10-06, 15:31
  3. Group und fetch first xx rows
    By linguin in forum IBM i Hauptforum
    Antworten: 6
    Letzter Beitrag: 04-08-06, 10:38
  4. overlay funktioniert nicht
    By steven_r in forum NEWSboard Programmierung
    Antworten: 2
    Letzter Beitrag: 16-05-06, 07:59
  5. SQLRPGLE group by
    By loeweadolf in forum NEWSboard Programmierung
    Antworten: 4
    Letzter Beitrag: 21-12-05, 19:02

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • You may not post attachments
  • You may not edit your posts
  •