0

Functions of Buttons

I have a table that has a button and they duplicate one of the sub tables for the next day. need a formula for this button, for duplicating all the data of the main table.

let c := (create 'GM TABLE');
let t := this;
c.(DATE := t.DATE + 1);
for i in t.AllTables do
    let d := duplicate(i);
    d.('GM TABLE' := c)
end;
closeRecord();
popupRecord(c)

 

And the second question, there are two tables, Tables1 and Tables2, with identical data. I need to create a button for deleting a record, I go to one of the tables and open the record there, there is a button that deletes this record, but I need to add a function to delete a single record in another table. Both tables subtables of one main table Table12

let result := dialog("Warning", "Are you sure?", ["Yes", "No"]);
if result = "Yes" then
    alert("Deleted");
    delete this
else
    alert("Canceled")
end

 

I found this, you need to add the function of deleting a record in table2

Regards

8 replies

null
    • Fred
    • 1 yr ago
    • Reported - view
    ekalcasino777 said:
    need a formula for this button, for duplicating all the data of the main table.

     I'm not sure if c is the main table or is t the main table? If it is t then.

    Try:

    for i in t.AllTables do
        let d := duplicate(i);
        d.('GM TABLE' := c;
            field2 := t.field2;
            field3 := t.field3;
            etc...)

     

    ekalcasino777 said:
    I need to create a button for deleting a record, I go to one of the tables and open the record there, there is a button that deletes this record, but I need to add a function to delete a single record in another table. Both tables subtables of one main table Table12

    How is the record in table 1 linked to a record in table 2 besides Table12? If you are in Table1 and you do a search in Table2 for all records that linked to Table12 you will get multiple records so there must be another field that links the record in Table1 and the record in Table2 that you want to delete.

    • ekalcasino777
    • 1 yr ago
    • Reported - view
    Fred said:
    How is the record in table 1 linked to a record in table 2 besides Table12? If you are in Table1 and you do a search in Table2 for all records that linked to Table12 you will get multiple records so there must be another field that links the record in Table1 and the record in Table2 that you want to delete.

     

      They are not related to each other, to create a record in these tables, I use a button that automatically creates records in both tables at the same time. the name of these tables alltables and alltables2

    Thanks for help Fred

    • Fred
    • 1 yr ago
    • Reported - view

    Is there some other data that links them like a date field or something else?

      • ekalcasino777
      • 1 yr ago
      • Reported - view

      Fred 

      Both of these tables are in the main table "Gm Table" and main table has date

      • ekalcasino777
      • 1 yr ago
      • Reported - view

      Fred 

      Here is the button that creates the entries, and they are related in that both display information on the day that is indicated in the date of the main page

      • ekalcasino777
      • 1 yr ago
      • Reported - view

      Fred 

      Tables differ in functions, but the name and serial number that the program assigns to them are the same. 

      Button have formula 

      let result := dialog("WARNING", "ARE YOU SURE YOU WANT TO DELETE THE TABLE PERMANENTLY?", ["Delete", "Cancel"]);
      if result = "Delete" then
          alert("Deleted");
          delete this
      else
          alert("Canceled")
      end

      it deletes a record and I need it to delete the same record in the table AllTable2

    • Fred
    • 1 yr ago
    • Reported - view

    Your buttons say "Create Table" and "Delete Table" do you mean records?

    What fields are in Table1 and Table2?

    What fields are in GM Table?

    Can you post a sample db?

      • ekalcasino777
      • 1 yr ago
      • Reported - view

      Fred 

      Thanks Fred for you time.

      today there was an open office and Maria helped to solve this problem. She gave the formula

      let result := dialog("WARNING", "ARE YOU SURE YOU WANT TO DELETE ?", ["Delete", "Cancel"]);
      if result = "Delete" then
          alert("Deleted");
          let t := this;
          delete first((select Table)['field Name' = t.field_Name]);
          delete this
      else
          alert("Canceled")
      end
       

      Еhank you very much for your advice

Content aside

  • 1 yr agoLast active
  • 8Replies
  • 159Views
  • 2 Following