0

Copy Yes/No function value

The table has a button that creates a copy of some records from the table for the next day.  Part of the formula looks like this

 

let c := (create 'TABLE');
    let t := this;
    c.(DATE := t.DATE + 1);

for i in t.'table 1' do
        let d := duplicate(i);
        d.('TABLE' := c)

end;

Help please create that part of the formula, where the value of the field  "Yes/no" will be copied for next day

Regards 

9 replies

null
    • Fred
    • 1 yr ago
    • Reported - view

    I don't know where you want to copy but you just add your field names:

    let c := (create 'TABLE');
        let t := this;
        c.(DATE := t.DATE + 1;
            yes/nofield := t.yes/nofield
    );
    for i in t.'table 1' do
            let d := duplicate(i);
            d.('TABLE' := c;
            yes/nofield := i.yes/nofield
    )
    
      • ekalcasino777
      • 1 yr ago
      • Reported - view

      Fred Hello

      Same table, this button make a next day blank.  This formula give me mistakes:

      Field not found: GM TABLE at line 23, column 22

      not record id at line 23, column 29

      Expression does noreturn a record: в фе line 25, column 4

    • ekalcasino777
    • 1 yr ago
    • Reported - view

    We thought it might be easier to make a copy of the 'GM TABLE' table as a form the next day, with all the records up to that moment. Can you give us a formula to copy the GM TABLE with all sub-tables and records?

    Thanks 

    • Fred
    • 1 yr ago
    • Reported - view
    ekalcasino777 said:
    Field not found: GM TABLE at line 23, column 22
    not record id at line 23, column 29
    Expression does noreturn a record: в фе line 25, column 4

    Is there a field called 'GM Table' in the current table? I don't know what table you are starting in so I can't say for sure. All the rest of the errors also stem from this issue.

      • ekalcasino777
      • 1 yr ago
      • Reported - view

      Fred  I need to copy YES/NO button value in new day table "GM TABLE"

    • Fred
    • 1 yr ago
    • Reported - view
    ekalcasino777 said:
    Fred  I need to copy YES/NO button value in new day table "GM TABLE"

     I understand that. I'm trying to help you figure out the error.

    The error says it can't find 'GM Table'. Your code is:

    for i in t.'GM TABLE' do
    

    My question is, what is the name of the table that you are creating this code in?

    Does the current table have a reference field called 'GM TABLE'? If not then you need to put the name of the reference field to 'GM TABLE'.

    Question about your code:

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

    1) Why are you creating a single record in line 1 in 'GM TABLE' then creating a bunch of records in line 6 in the same table? You are not linking the current record to the new record in 'GM TABLE'.

    2) Line 8 sets 'Follow Me' to be equal to the variable c, which you set above in line 1 to be equal to the newly created record in 'GM TABLE'.

    What kind of field is 'Follow Me'? Is it the name of a reference field to 'GM TABLE'? If it is not then you will need to change the line to:

    d.('Follow Me' := c.'Follow Me')
    or you and use the reference to the current record since it is the same
    d.('Follow Me' := t.'Follow Me')
    

    You need to change it because the variable c is equal to the record link of a record in 'GM TABLE'.

      • ekalcasino777
      • 1 yr ago
      • Reported - view

      Fred it seems to me that the best solution for us is to simply copy all the table data "GM TABLE" the next day. Do not copy it partially, but the all table. Please tell me the formula for the button that just creates a copy of the entire table for the next day. 

          Regards

    • Fred
    • 1 yr ago
    • Reported - view
    ekalcasino777 said:
    it seems to me that the best solution for us is to simply copy all the table data "GM TABLE" the next day. Do not copy it partially, but the all table. Please tell me the formula for the button that just creates a copy of the entire table for the next day. 

     Let me make sure I understand you. You have a Ninox table called 'GM TABLE'.

    Now you want to duplicate the entire Ninox table called 'GM TABLE'?

    If so there is no button to duplicate an entire Ninox table.

    Since you also use the word table in your business, are you talking about duplicating a record, which you call a "table", in 'GM TABLE'?

    If you want to do this, then you can use the duplicate function.

    duplicate(this)
    
      • ekalcasino777
      • 1 yr ago
      • Reported - view

      Fred Nice 
      Thanks 

Content aside

  • Status Answered
  • 1 yr agoLast active
  • 9Replies
  • 78Views
  • 2 Following