0

Block of Time on Calendar

I am looking to create a block of dates on the calendar. I have a start date and finish date and i also want the days in-between to be used for the same project. Is this possible  

1 reply

null
    • Fred
    • 1 yr ago
    • Reported - view

    I don’t use the calendar at all, but from my limited investigation it looks like Ninox adds a calendar event for any record that has a data in a date field.

    Since I have no idea what your structure is or any field names, I’m going with the following guesses:

    1) you want a button so you can instigate the creation of events

    2) the start/end date fields are on the same table as the button

    3) you will be creating records in another table then the one the button is on

    4) you need to create records that include the start and end date

    The code would look something like:

    let t := this;
    let countDays := days('start date field', 'end date field');
    for loop1 in range(0, countDays) do
            newRec := create othertableName;
            newRec.(DateField := t.'start date field' + loop1)
        end;
    

    Line 1: gathers the current record data and puts it in a variable.

    Line 2: uses the days() command to find the number of days between your start date and end date

    Line 3: starts the for loop command that uses the number of days in a range() function to set the out limit of how many times Ninox needs to loop around. The range is set to start at 0 and go up to the numbers of days from line 1.

    Line 4: creates a new record in the other table that has the records that show up in your calendar.

    Line 5: sets the date field in the other table to be equal to the start date field plus the number in the range the loop is in. The first time through loop1 = 0, so the date field in the new record is set to the start date. The second time through it will be equal to start date plus 1. etc…