0

Neuer Datensatz (Untertabelle) per Button...

Ich habe eine Untertabelle „Positionen“ (für Kostenvoranschlag, Rechnung, Lieferschein etc.). Über einen Button kann ich einen Datensatz mit „delete this“ löschen, aber ich kann keinen neuen Datensatz per Button erstellen.

Der neu erstellte Datensatz soll grundsätzlich leer sein, aber bereits mit einer bestimmten ID-Nummer vorausgefüllt und verknüpft sein. Diese ID-Nummer stammt aus einer Skript-Formel (Feldname: zu ID-Nr.).

Ich habe folgende Skripte ausprobiert, aber keiner hat funktioniert:

---

let me := this; let new := (create Positionen); new.Positionen.'zu ID-Nr.' := me; popupRecord(new);

---let me := this; let new := (create Positionen); new.Rechnung.Positionen.'zu ID-Nr.' := me; popupRecord(new);

---let me := this; let new := (create Positionen); for i in me.Rechnung.'ID-Nr.' do let newPos := 'zu ID-Nr.'; newPos.('zu ID-Nr.' := i.'zu ID-Nr.'); popupRecord(new);

---let me := this; let new := (create Positionen); new.Rechnung.'ID-Nr.' := text('zu ID-Nr.'); popupRecord(new);

Alle Versuche schlugen fehl. Hat jemand eine Idee, wie ich das korrekt umsetzen kann?

Danke für eure Hilfe! 

1 Antwort

null
    • Fred
    • vor 1 Monat
    • Gemeldet - anzeigen

    Since this is a sub Table then you want to link to the main table. So when you use 'this' you are referring to the main table record you are on.

    let me := this;
    let new := (create Positionen);
    new.(
        mainTablereferencefieldname := me
    );
    popupRecord(new)

    For the fields 'zu ID-Nr.' or 'ID-Nr.', according to your code they are fields in reference fields (new.Positionen or new.Rechnung). Which will be blank when you create a new record, so you can not modify the fields.

    If you had a field called 'zu ID-Nr.' in the Positionen table then you can do something like:

    let me := this;
    let new := (create Positionen);
    new.(
        mainTablereferencefieldname := me;
        'zu ID-Nr.' := number(me)
    );
    popupRecord(new)
    

    Hope this helps.