0

How to auto create new record every day?

I have to create a daily record, but I have to hit the button every time. Now I want to use loop function to create new record every day. can someone show me how please?

29 replies

null
    • Fred
    • 7 mths ago
    • Reported - view
     said:
    Thanks, I'm going to try it after 4pm PST as I am also in PST.

     Well I was able to duplicate the issue. I thought they fixed date issues like this when they made DBs Timezone independent. What an annoying "feature".

    Did Ninox say there was no way to make this work?

    Playing around I was able to get it find the "correct" records by stripping out the year, month, and day out of the today() command, turn them into numbers, then use the date() command to put it back together.

    It looks something like this;

    let xyear := number(year(today()));
    let xmonth := number(month(today()));
    let xday := number(day(today()));
    let anyOldRecs := select 'THU/CHI' where NGAY = date(xyear,xmonth,xday);
    if count(anyOldRecs) < 1 then
        create 'THU/CHI'
    end
    

    This is where used the extra formula field I suggested earlier comes in handy. Originally, I put this in the code box:

    debugValueInfo(select Table1 where Date = today())
    

    And it would show me:

    nid([])

    which means it found no records matching even though there was one.

    Then I played around and settled on this:

    let t := this;
    let xyear := number(year(today()));
    let xmonth := number(month(today()));
    let xday := number(day(today()));
    debugValueInfo(select Table1 where Date = date(xyear, xmonth, xday))

    and I got back:

    nid([A21])

    So now I know it found something and now if I transfer the new code to the button then the if statement will work.

      • Fred
      • 7 mths ago
      • Reported - view

       you don’t have to change all today(). Just ones that you find issues with. 

      • Nguyen_Nhat_Dong
      • 7 mths ago
      • Reported - view

       this one here is not working also, after 4 PM, can you check?

       

      let selectNGAY := last(select 'THU/CHI' where NGAY = today());
      'THU/CHI (CONG NO BAN HANG)' := selectNGAY

      • Fred
      • 7 mths ago
      • Reported - view

      what did Ninox say is the solution?

      • Nguyen_Nhat_Dong
      • 7 mths ago
      • Reported - view

       no one say the solution to me lol.

Content aside

  • Status Answered
  • 7 mths agoLast active
  • 29Replies
  • 189Views
  • 3 Following