0

Untertabelle in neue Untertabelle Kopieren

Hallo ich habe eine Tabelle WORKORDER daunter habe ich 2 Untertabellen, WO-TASK und WR-TASK, ich möchte nun bei Button klick sämtliche Datensätze von WO-TASK in die Untertabelle WR-TASK Kopieren, jedoch wenn ein  Datensatz im Feld TASK-POS. schon vorhanden ist soll der ausgelassen werden. 

wer kann mir da auf die sprünge helfen?

3 Antworten

null
    • Fred
    • vor 5 Tagen
    • Gemeldet - anzeigen

    Do both tables (WO-TASK and WR-TASK) have the TASK-POS field? So if there is a record in WR-TASK with the same data in TASK-POS then don't copy the WO-TASK record?

      • Alexander_Prinz
      • vor 4 Tagen
      • Gemeldet - anzeigen

       Yes in both Tables is the field TASK-POS, and yes it should not copy if its already exist

    • Fred
    • vor 3 Tagen
    • Gemeldet - anzeigen

    You can try something like this in a button in a WORKORDER record:

    for woRec in WO-TASK do
        let wrCheck := WR-TASK[TASK-POS = woRec.TASK-POS]
        if count(wrCheck) = 0 then
            create WR-TASK.(
                WORKORDER := woRec.WORKORDER
            )
        end
    end
    

    Line 1: starts the for loop with the variable woRec to store each record in the WO-TASK subtable.

    Line 2: creates a variable where we find any WR-TASK records that have the same TASK-POS data as the current record in the loop (woRec).

    Line 3: starts the if statement checking if the variable from line 2 (wrCheck) is equal to 0 and if it is

    Line 4: then we create a new record in WR-TASK

    Line 5: then we link the newly created WR-TASK record to WORKORDER using the link from woRec. If you need to copy other data then add a semi-colon (;) at the end of line 5, then add each new field you need to copy. Keeping everything within the close parenthesis ")".

    Lines 6 - 8 close their respective commands.

    I haven't tried it out, but it should work as you wanted.

Content aside

  • vor 3 TagenZuletzt aktiv
  • 3Antworten
  • 39Ansichten
  • 2 Folge bereits