0

Add record Button

I want to create a button to add new record in a table named 'Interventi' from a table 'Caldaie'.

The button on click must add a new record in a table 'Interventi' inheriting some field inserted in table 'Caldaie'.

How to do it?

Thank you.

Sorry for my bad english.

6 replies

null
    • Nick
    • 4 yrs ago
    • Reported - view

    Hi Alex,

    Let's assume that you have 2 tables with common fields: DateField and TextField.

    The code for the button in the table Caldaie:

    ---

    let myID := Id;
    let dt := Date;
    let txt := Text;
    let i := (create Interventi);
    i.(Date := dt);
    i.(Text := txt);
    openRecord(i)

    ---

    • Alex_Benetti
    • 4 yrs ago
    • Reported - view

    Thanks, the routine works perfectly!

    • Choices_Software_Dean
    • 4 yrs ago
    • Reported - view

    In the above situation, if both tables are the children of a Contacts table, how can I pass the Contacts.name from one child table to the other child table when the new record is created?

    • Nick
    • 4 yrs ago
    • Reported - view

    @Dean,

    If I understand you correctly, this creates records to both child tables and sets the Contact Name:

    ---

    let myID := Id;
    let name1 := Contact_Name;
    let c1 := (create Child_1);
    c1.(Contact := myID);
    c1.(Contact_Name := name1);
    let c2 := (create Child_2);
    c2.(Contact := myID);
    c2.(Contact_Name := name1)

    ---

    Screenshot 2019-10-27 at 8.33.34 AM

    • Choices_Software_Dean
    • 4 yrs ago
    • Reported - view

    @Nick,

    Thank you very much for your clear reply and image!

    • Nick
    • 4 yrs ago
    • Reported - view

    You 're welcome gyus! 

Content aside

  • 4 yrs agoLast active
  • 6Replies
  • 2062Views