0

Is there a way to automatically create multiple records from a button?

I have a database I use to maintain a small budget for a coffee club (32 menmbers). I have a members table, income table and an expense table with a invoice subtable. The way my database is set up, I have to create records every month for each member and when they pay I enter the data via a switch. I want to automatically create records in the income table for monthly  membership fee that I'm collecting every month.
I have been using Ninox on my iPad for sometime now but I only use it for very simple personal databases. Can anyone help?

1 reply

null
    • Nick
    • 4 yrs ago
    • Reported - view

    Yes there is.

    For this example, create a number field e.g. 'Nr of records' (how many records will be created).

    Use this code for a button placed to Master table.

    ---

    let reply := dialog("Confirmation!", "I will create " + 'Nr of records'+ " records, with Members Data.
    Continue?", ["Create", "Cancel"]);
    if reply = "Create" then
    let myID := Id;
    let myField1 := Field1;
    let myField2 := Field2;
    let nrRec := 'Nr of records';
    for i from 0 to nrRec do
    let q := (create Child_Table_Name);
    q.(Field1:= myField1);
    q.(Field2:= myField2);
    q.('Ralationship Name' := myID);
    alert(nrRec + " Member records were created.")
    end
    end

    ---

    Of course, you can remove the dialog and the alert if you want.

    I hope this is clear...