0

Seems basic math and date function are bugged

Hello I am evaluting Ninox in a trial database and need to follow projects Tasks.

I am trying to to update a Task Table with a calculation of End Date as Start Date + Workdate (5 days a week).

To do that I needed the weekday and round function to make the below code that works now. 

let x := (weekday(Start + 1) + 'Work Days') / 5;
let oo := 2 * round(x - 0.5);
Test := x;
End := Start + oo + 'Work Days'; 

 

I identifed two bugs:

1) round function is not rounding off the number but doing the same as floor function which is rounding to nearest. I had to substract 0.5 in second line !

2) the weekday should return 0 on Mondays. I found it is shifted by one day and returns 0 on Tuesday and I had to add 1 to the Start day to have it work correctly.

Please confirm that these two functions are bugged.

 

As I am evaluating Ninox, this raises an important question, if you correct in the future these basic functions, the above code will not work any more.

How are we warned of any update done with the Cloud version? Same on professionnal version ?

There seems to be no way to have a Sandbox where we could check and validate new releases.

 

Thanks.

2 replies

null
    • John_Halls
    • 2 yrs ago
    • Reported - view

    Hi Daniel

     

    Neither of the functions have bugs. Sorry to say I don't think your solution is correct. You problem was really quite hard to solve and it boils down to three elements.

    1. The number of days to add

    2. The number of weekends that are accounted for regardless of the start date's day of the week

    3. A potential additional weekend

     

    Placed in a formula field the code this becomes

     

    let daysToAdd := WorkDays - 1;
    let dow := weekday(StartDate);
    let weekends := floor(daysToAdd / 5);
    let weekendDays := weekends * 2;
    let extraWeekendDays := if floor((daysToAdd + dow) / (weekends + 1)) > 4 then
    2
    else
    0
    end;
    StartDate + daysToAdd + weekendDays + extraWeekendDays

     

    Regards John

    • Rafael Sanchis
    • Rafael_Sanchis
    • 1 yr ago
    • Reported - view

    John Halls

    Hi John, I find these script and work fine,  there are any way to Add a HOLIDAY in this script ?

    Thinking in one Table only Holidays.

    Thanks

Content aside

  • 1 yr agoLast active
  • 2Replies
  • 244Views
  • 1 Following