Create data dynamically without database entry

Is it possible to create data for an element on the fly, without creating database entries?

For instance, I’m working on a scheduling app, in which users can choose a time slot within a longer calendar event.
[for instance, event is on Oct 24, 09:00 am to 2:00 pm, and users can choose any of the 10 half hour slot in that range: 9:00, 9:30, etc]
The time slots would be displayed in a repeating group.
I’d prefer not to have to create database entries with these time slots, as that seems wasteful.
Can I create a list of times programmatically, dynamically?

Thanks!

What do you mean by wasteful? Of the time it takes to create them or of the space they would take up in your database?

Your storage capacity of things saved to your database is only affected by images and files, not really by text stored in the database.

But there are plugins like the air date time picker or dropper that can allow you to not have time slots stored in your database. You can also make use of how time is used on the web, which is as a number of milliseconds and create your own time picker that utilizes some math to calculate what hour and minute of the day the choices are.

Thank you Boston.

By wasteful I mean that it creates permanent database entries for temporary selection options.
These will accumulate with use and clutter the database, and I worry might eventually slow down queries.

Additionally, there are many use cases in which I would like to dynamically create objects based on a combination of multiple attributes, which would make the database cluttering exponential.

How do you expect to save the scheduled event?

If you have a data type that is ‘meeting’ it should have a time field on it saved in the database, otherwise it would never have any value to just create meetings on a calendar with no time association.

Also, you can when saving a date, put the time as well, which bubble would automatically set if you don’t instruct it on what time to set. The ways to do that is to use a date/time picker or you could create a data type called time slots and reference that.

It sounds like you don’t want to use a time picker and want to create your own time picker using a repeating group.

How is this group going to be set up to display the times?

I created something like this in my app and I use time slots as data type to allow the user to select the time.

Screen Shot 2020-10-27 at 2.00.41 AM

When it is on a page it is part of for selecting event times there is also the AM and PM selector.

My database is not cluttered because of it in any way. I have one data type called time slots.

Then on the event data type I have a Date Start and Date End and I use the value from the time selector’s selected time slot to set the time of the date field.

If you are creating a scheduling app, you need date and time to schedule something, so whatever the thing is that you are scheduling will need to have at a minimum the date field and you can set the time directly onto that, you do not need to save the time slot as a separate field.

Custom states, which can also be lists

1 Like

How do you set a custom state list to be a list of time slots without having the time slots already created?

3 Likes

Something like this:
RG with custom states slot (single date) and slots (list of dates)

  1. On page load slot = start time
  2. recursive workflow on RG’s slot only when slot <=end time
  3. slots = slots:plusitem slot
  4. slot = slot +minutes: 30

Thank you DeadPoet!

Dynamically creating a list of slots in a custom state sounds great.
Is there a workflow action that can generate a list of objects?
Or is the recursion the only method?
How do you create a recursive workflow?

Thanks!

@GuyRoss

Okay, so I believe you’d have to signal the start time as a number and make it equal to total minutes, so 1AM would be 60 while 1PM would be 780.

Then you need to also have a custom state of end time, which also would be a number value for storing the total minutes of the end time slot value.

After that you can run the recursive backend workflow to create the other time slots which would become a custom state list of time slots. If I am not mistaken, I do not believe you can run a recursive workflow on the page to set the custom state value, as the only way I know of how to run recursive workflows is in the backend, which would not provide access to a pages custom state value.

Is there a way to do recursive workflows on the page to set the custom state?

If there is a way to do a recursive workflow on the page to set that custom state list and you can populate the custom state list, then in your repeating group you will need to set you text to display the minutes as time values like 1:30PM or 4:30AM, which would just require a bit of math and formatting.

If it is not possible to run a recursive workflow on the page, which I believe it is not, then the custom state list would not be possible in my mind, but you could try to implement a similar technique by using the list of numbers plugin to create the list of numbers (ie: total minutes) and then transfer that to the custom state list of time slots.

Lastly, for the purposes of scheduling, how do we account for the time slots that have already been scheduled? My assumption is this is for a professional who wants to allow people to schedule meetings of some kind with them, and so we need to make sure any time slots on any particular date that have already been scheduled, and therefore made unavailable, do not make their way into the custom state list of time slots.

For that you would then need to run a workflow that looks at the user who ‘owns’ the calendar schedule to see their currently scheduled events for that day, extract the time from the scheduled event (if there are more than one, extract the time from the list of events), and then run a workflow of some kind to remove that list of unavailable times from the custom state list of times.

Obviously, I’ve never done this and I’d love to see an example of how it works, because I’d like to learn a new trick to implement in the future.

@deadpoetnsp
Can we do the same with API data types?
I mean i store API data in custom state, but when want to append new item to the list , i’m not able to create an object of API data type.