0

Is this possible in ninox?

I have a table with time slot records of 15 minutes starting at 9:00am til 7:00pm, like 9:00, 9:15, 9:30 etc.

In another table I created services eg. 

service 1 takes 20min 

service 2 takes 45min etc

I start with record at 9:00am chose service 1 and 2 duration is 65min. So end time is 10:05

Is there a way that all records started from 9:15am untill 10:05 respectively 10:15am get an X in a textfield? Kind of ‚blocking‘ the time slots?

I can do it manually in View table, but I wish there would be a Script.

if there is another way to create this Kind of planner, I would apreciate and help and suggestions.

Here is an example db

thanx a lot 

kruna

22 replies

null
    • Fred
    • 9 mths ago
    • Reported - view

    Have you consider using great html calendar?

      • Kruna
      • 9 mths ago
      • Reported - view

       yes I did consider this masterpiece of work. But in this case I Need to have the employees in columns not the dates. In fullcalendar its a premium feature - 

      https://fullcalendar.io/demos

      The third demo ‚Resource time grid‘ would be the Solution here, but another 500 bucks a year - well not affirdable.

      thnx

    • Fred
    • 9 mths ago
    • Reported - view

    Looking at your DB, where do you want this button to live?

      • Kruna
      • 9 mths ago
      • Reported - view

        hi Fred, I didnt thought about a button but a trigger, but also Button would help a lot and could be in parent table.

      thnx

      • Fred
      • 9 mths ago
      • Reported - view

      Ok, but what is the table name you want this button in?

      • Kruna
      • 9 mths ago
      • Reported - view

       oh, please excuse me that I wasnt clear. The parent table is Scheduleplanner.

      thnx

    • Fred
    • 9 mths ago
    • Reported - view

    Try out the attached DB. If you open Scheduleplanner and open the record you will see a new tab called Tab. There you can select a time slot, then select any number of services then click on the Mark Scheduled button and it will change a new yes/no field in Dailyplan called Scheduled from No to Yes.

    You can use the Reset Schedule button to change them all back to No and test it out again.

    You can ignore the other formula fields. I use many formula fields while I develop scripts to help me make sure my logic is correct and I'm getting the proper dataset.

    The hard part was figuring out a way to always get the time slot that covers any time period that is below the next 15 min timeslot.

    • Kruna
    • 9 mths ago
    • Reported - view

    Hi  - that so anweisen, Iam really speechless for what you scripted. It works like a charme!!!👍👍👍

    I have a couple of questions pls:

    1. is it possible to when I chose from dcf ‚select start time‘  eg 9:00 and from dmcf ‚Select Service‘ eg Service xy. Then I Chose another time lets say 10:00 with Service ‚abcd‘.

    if I go back to start time 9:00 there should be respektive Service, which means ‚xy‘?

    2. How can I have the Service seen in subtable like here.

    right now I also entered the Service in  the subtable, but thats kind of double ‚work‘.

    I am so impressed about your work and Knowledge. My hard parts to figure out Must be piece of cake for you!😅😅

    Thank you so much Fred!!👍👍

    • Kruna
    • 9 mths ago
    • Reported - view

    Hi please excuse me, I just came across another questions.

    3. Can I trigger dcf ‚select start time‘ and dmcf ‚select service‘ to same Dynamic Fields in subtable?

    4. how and where is best to implement an appointment field, so that it will be schown in camendar?

    thank you very much

    • Fred
    • 9 mths ago
    • Reported - view
     said:
    1. is it possible to when I chose from dcf ‚select start time‘  eg 9:00 and from dmcf ‚Select Service‘ eg Service xy. Then I Chose another time lets say 10:00 with Service ‚abcd‘.
    if I go back to start time 9:00 there should be respektive Service, which means ‚xy‘?
    2. How can I have the Service seen in subtable like here.
    right now I also entered the Service in  the subtable, but thats kind of double ‚work‘.

     Is 1 and 2 the same question? You want to add the service selected in Scheduleplanner to a service in Dailyplan?

    If that is true, since Select a Service is a dMCF then you will need a subtable that can store each service selected for each timeslot.

    4. how and where is best to implement an appointment field, so that it will be schown in camendar?

    Maybe make a child table in Scheduleplanner that tracks appointments?

    3. Can I trigger dcf ‚select start time‘ and dmcf ‚select service‘ to same Dynamic Fields in subtable?

    You can, but I'm not sure why.

    • Kruna
    • 9 mths ago
    • Reported - view

    Good morning , well now I dont See the wood for the trees.😅

    Actially what I would like to achieve is like shown in Screenshot, that the First timeslot shows the Service and the other slots an „x“.

    I did achieve this by chosing the Services in subtable First and then I have to chose the same Services again in parent table in second step, so that the corresponding timeslots are marked. This is why I wondered wheather its possible to trigger the Service from subtable to parent table, like copy it eg with a button?

    Another challenge for me is to get this to work when there are more employees and each employee has two columns, like button ‚Mark Scheduled‘ , „Reset scheduled“ twice.

    if I have more employees, this will get funny😅

    Concerning the appointment Field, unfortunately I dont know how to implement it.

    I also think about using  Sotirios html calendar to have a monthly/weekly overview.

    thnx

    • Fred
    • 9 mths ago
    • Reported - view
     said:
    I did achieve this by chosing the Services in subtable First and then I have to chose the same Services again in parent table in second step,

    I would be careful of using dMC fields to store data. There is an issue with Ninox where dMC fields data gets corrupted when the root table of the dynamic field gets reorganized.

    But to answer this question, it is easy to copy dMC selections to another dMC. Assuming the second dMC is pointing to the same table then all you need to do is:

    let t := this;
    seconddMC := numbers(t.firstdMC)
    

    A way around this would be to create a child table of Dailyplan that tracks how many services are tied to a specific timeslot.

    Another challenge for me is to get this to work when there are more employees and each employee has two columns, like button ‚Mark Scheduled‘ , „Reset scheduled“ twice.

    I would suggest you add another dC field that allows you to select employee.

    Concerning the appointment Field, unfortunately I dont know how to implement it.

    The first step is figuring out where the appointment field should live. I don't think it belongs in the Dailyplan table because Dailyplan is broken down by 15 minute time increments and that doesn't fit the appointment format.

    My initial thought is to create a table called Appointments. You can make a link to Services and Client and employee.

    Seems like Scheduleplanner is really a dashboard. You don't need to create a record for each day. You can add a date field to allow users to select a date to schedule an appointment or to view appointments.

    The big thing to figure out is how you want to handle scheduling appointments when multiple services are selected? Is there an order that the services will be handled? Or just that multiple services will be done during that time frame. If that is true then you will need a ServicesRendered child of appointments to track the services scheduled.

    • Fred
    • 9 mths ago
    • Reported - view

    Take a look at a possibility for the appointments table in the attached DB.

    • Kruna
    • 12 days ago
    • Reported - view

    Hi Fred, I would like to open the topic again please. I stopped working on this db, but would Like to continue now. Can you pls Take a look at the db? Somehow your code doesnt work anymore. When I choose a service the x‘s are not shown anymore. Do you have an idea why? In older dates you can still See that it worked once.   
     

    thnx a lot

    kruna

      • Fred
      • 11 days ago
      • Reported - view

       can you remind me the table and buttons that you are having issues with?

    • Kruna
    • 11 days ago
    • Reported - view

    hi @Fred, I took your db fredV2 because its easier to explain what I would like to acomplish.

    I’m in table ‚Scheduleplanner‘ and when I click in subtable lets say 9am I can chose service(s) eg ‚Dauerwelle 120min‘ and if it starts at 9am it ends at 11am. If I click button ‚Mark Scheduled‘ all the other records „scheduled“ till 11am should be scheduled=1 and marked with ‚x’ Like in the picture Abonnement. Right now it just schedules the record 9am. If a service takes 20min or 25min ten it like 30min. It worked, but now it doesn’t work anymore. Maybe it has to do with some ninox updates.

    thnx Kruna

      • Fred
      • 10 days ago
      • Reported - view

       So here is the updated button code:

      let allTimeslots := ((select Timeslots) order by Uhrzeit);
      let selectedTimeRec := record(Timeslots,number('Select Start Time'));
      let selectedServiceRecs := for loop1 in numbers('Select Service') do
              record(Services,loop1)
          end;
      let totalServiceTime := sum(selectedServiceRecs.Zeitdauer);
      let finalTime := number(raw(selectedTimeRec.Uhrzeit)) + number(raw(totalServiceTime));
      let recOfEndTime := last(allTimeslots[Uhrzeit < finalTime]);
      let findIndex := index(allTimeslots, recOfEndTime);
      let plusOneRec := item(allTimeslots, findIndex + 1);
      let recsToModify := Terminplaner[Auswahl.Uhrzeit >= selectedTimeRec.Uhrzeit and Auswahl.Uhrzeit <= plusOneRec.Uhrzeit];
      recsToModify.(Scheduled := 1);
      "create new appointment";
      let totalServiceTimeHour := floor(number(totalServiceTime) / 3600000);
      let totalServieTimeMinutes := (number(totalServiceTime) - totalServiceTimeHour * 3600000) / 60000;
      let xstartDateTime := datetime(year('Select a Date'), month('Select a Date'), day('Select a Date'), selectedTimeRec.hour, selectedTimeRec.minutes);
      let appointmentCheck := (select appointments where startDateTime = xstartDateTime);
      if length(appointmentCheck) = 0 then
          let newAppointment := (create appointments);
          newAppointment.(Appointment := appointment(xstartDateTime, time(totalServiceTimeHour, totalServieTimeMinutes)));
          "create apppointment services records";
          appointment(xstartDateTime, time(totalServiceTimeHour, totalServieTimeMinutes));
          for service in selectedServiceRecs do
              let newServicesAppointment := (create ServicesRendered);
              newServicesAppointment.(
                  appointments := newAppointment;
                  Services := service
              )
          end
      else
          alert("Appointment Conflict")
      end
      

      finalTime had to be rewritten and line 20 need to use xstartDateTime not startDateTime.

      I'm surprised it worked before.

      • Kruna
      • 10 days ago
      • Reported - view

        indeed it did. you can See the picture above. I had to mody the Code to this, as it showed errors, but Iam not sure, if its correct. Still it dies not work. (Sorry for the code, but somehow I can just Login wit IPhone and I cant put in Quotes) and the code is in Button ‚Mark scheduled“ right?

      Scheduled := 1;

      empl1 := 1;

      let allTimeslots := ((select Timeslots) order by Uhrzeit);

      let selectedTimeRec := record(Timeslots,number('Uhrzeit@R'));

      let selectedServiceRecs := for loop1 in numbers('R@Dienstleistung') do

      record(Services,loop1)

      end;

      let totalServiceTime := sum(selectedServiceRecs.Zeitdauer);

      let finalTime := number(raw(selectedTimeRec.Uhrzeit)) + number(raw(totalServiceTime));

      let recOfEndTime := last(allTimeslots[Uhrzeit < finalTime]);

      let findIndex := index(allTimeslots, recOfEndTime);

      let plusOneRec := item(allTimeslots, findIndex + 1);

      let recsToModify := Tabelle1.Terminplaner[Auswahl.Uhrzeit >= selectedTimeRec.Uhrzeit and Auswahl.Uhrzeit <= plusOneRec.Uhrzeit];

      recsToModify.(Scheduled := 1);

      "create new appointment";

      let totalServiceTimeHour := floor(number(totalServiceTime) / 3600000);

      let totalServieTimeMinutes := (number(totalServiceTime) - totalServiceTimeHour * 3600000) / 60000;

      let xstartDateTime := datetime(year(Tabelle1.'Select a Date'), month(Tabelle1.'Select a Date'), day(Tabelle1.'Select a Date'), selectedTimeRec.hour, selectedTimeRec.minutes);

      let appointmentCheck := (select appointments where startDateTime = xstartDateTime);

      if length(appointmentCheck) = 0 then

      let newAppointment := (create appointments);

      newAppointment.(Appointment := appointment(xstartDateTime, time(totalServiceTimeHour, totalServieTimeMinutes)));

      "create apppointment services records";

      appointment(xstartDateTime, time(totalServiceTimeHour, totalServieTimeMinutes));

      for service in selectedServiceRecs do

      let newServicesAppointment := (create ServicesRendered);

      newServicesAppointment.(

      appointments := newAppointment;

      Services := service

      )

      end

      else

      alert("Appointment Conflict")

      end;

      closeRecord()

       

       

      • Fred
      • 7 days ago
      • Reported - view

       I'm sorry for not replying sooner. I don't have a lot of free time right now. If someone else can jump in that would be great. If you don't mind waiting I can get to it in a week or so.

      • Kruna
      • 7 days ago
      • Reported - view

       of course no problem Fred. I am happy that you help me with this issue, no matter when! Thank you very much. :-)

    • Kruna
    • 10 days ago
    • Reported - view

    sorry I forgot to mention that I have a Button named „Mark scheduled“ also in table „dailyplan“ this is why I had to modify. and it marks the start time, but not the following timeslots eg 30min service its only 9am and not 9.00/9.15/9.30

    thnx Kruna

    • Fred
    • 6 days ago
    • Reported - view

    Found some time. Here is my changes. I only update the button in SchedulePlanner. I don't see how you can add the same button to DailyPlan since you don't have the same information.

    I did update the code to update the R@Dienstleistung field in DailyPlan so you can see the services selected.

Content aside

  • 6 days agoLast active
  • 22Replies
  • 208Views
  • 2 Following