Distribute dates between two others days.
I have the fields Plan 1 to Plan 5 with the following milestones 10%,25%,70%,90% and 100% in the Plan 1 date field I have the start date 8/02/2024 and in the Plan 5 date field I have the date end 23/02/2024
I need to distribute the dates for the Plan 2 Plan 3 and Plan4 fields depending on the % of the milestones automatic. The field Plan 2 Plan 3 and Plan 4 are fórmula field.
The other problems is no Holidays days, and no weekeeds.
I have not been able to create the formula in Excel either.
Too complicarte for me.
14 replies
-
wow, that is a tricky ask. You would first need a table of holidays since Ninox has no way of knowing what holidays you follow. Then you would need to figure out how many days 25%, 70% and 90% is between the start date and end date. Then add those number of days to the start date, then check if it falls on a weekend then move the date out till it falls on a weekday then check if it falls on a holiday then move it out again till it falls on a weekday. Do you want the dates to always be on a particular day of the week (always on Mondays or always on Fridays)?
Spain probably has multi-day holidays, so in your holiday table you will have a date field and number of day field, this can default to 1.
I'll give it a shot but it could take awhile. I'm also trying to learn SwiftUI and that is hurting by brain. Now I know the difference between low code and 'real' code.
-
Hi Raphael, try this script. I also didn't quite understand why it starts at 10%. In line 3 you have to add an array for holidays, or a reference to a holiday table. Mirko
let all := days('Plan 1', 'Plan 5'); let start := 'Plan 1'; let holidays := [date(2024, 2, 6), date(2024, 2, 7)]; EXAMPLE let allworkdays := workdays('Plan 1', 'Plan 5'); let result := for i in range(0, all) do let idx := date(year(start), month(start), day(start) + i); if weekday(idx) < 5 and not contains(holidays, idx) then text(date(year(start), month(start), day(start) + i)) end end; let twentyfive := round(cnt(result) * 15 / 100); let seventy := round(cnt(result) * 60 / 100); let ninety := round(cnt(result) * 80 / 100); item(result, twentyfive) + " " + item(result, seventy) + " " + item(result, ninety)
-
Yes. holidays contains an array of dates, or selfemade select HolidaysTable.date.
If 'Plan 2' an so on are fx-fields then split the last line of script.
For 'Plan 2'item(result, twentyfive);
'Plan 3'
item(result, seventy);
and 'Plan 4'
item(result, ninety);
If you use button or trigger and fields are textfields then delete last line and take
'Plan 2' := item(result, twentyfive); 'Plan 3' := item(result, seventy); 'Plan 4' := item(result, ninety)
Mirko
-
if 'Plan 5' <= DataDate and 'Plan 4' != 0 then 'Mileston 5' else if 'Plan 4' <= DataDate and 'Plan 4' != 0 then 'Milestone 4' else if 'Plan 3' <= DataDate and 'Plan 3' != 0 then 'Milestone 3' else if 'Plan 2' <= DataDate and 'Plan 2' != 0 then 'Milestone 2' else if 'Plan 1' <= DataDate and 'Plan 1' != 0 then 'Milestone 1' end end end end end
HI Mikro one problem here.
The DataDate is 16/Feb/2024 the 'Plan 2'is 15/Feb/2024 is smaller than DataDate the field PV% the formula written above should be 25% no 10%. The Plan 2, Plan 3 and Plan are fórmula field.
If the fields Plan2, plan3 Plan 4 are Date fields works perfect.
There are any way to solve this.
Content aside
- Status Answered
- 10 mths agoLast active
- 14Replies
- 89Views
-
3
Following