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
    • 5 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
    • 5 yrs ago
    • Reported - view

    Thanks, the routine works perfectly!

    • Choices_Software_Dean
    • 5 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
    • 5 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
    • 5 yrs ago
    • Reported - view

    @Nick,

    Thank you very much for your clear reply and image!

    • Nick
    • 5 yrs ago
    • Reported - view

    You 're welcome gyus! 

Content aside

  • 5 yrs agoLast active
  • 6Replies
  • 2075Views