Forum Academy Marketplace Showcase Pricing Features

Setting up a calendar's paydays

I’m trying to allow the user to set paydays on the calendar. The user first selects a date from the date picker then from the dropbox chooses either option “weekly, biweekly, or monthly” the press “set payday” button. Based on what the user selects from the dropbox the calendar is supposed to populate the corresponding date cells for the entire calendar, although I’m having trouble figuring out how to achieve this. Maybe someone can help… Thanks… https://bubble.io/page?type=page&name=dos&id=practice-stuff&tab=tabs-1

I haven’t tried it, but I am thinking,

User selects the start date for the calendar and an end date for the payroll period, e.g. 1st Jan, 31 Dec. He hits Go. This adds the first payroll event to the calendar. The workflow then calls a Custom Event to CreateNextPayDay, This will have multiple versions depending on if the user selected weekly, fortnightly, monthly etc. The custom event will then create a new payroll thing, taking the last entry as its base and add the relevant x number of days to it, and then call itself again, it will keep calling itself until the end date is reached.

That’s a rough outline, but haven’t even tried to build it. Maybe some food for thought though!

Thanks. I’ve never created a custom event so I’m still at a loss. I’ll give a shot though.

I have had a play today and managed to create workflows that auto-generate and populate the calendar :grinning:

You need to use custom schedule event triggers.

  1. You cannot use normal workflow trigger as you overflow the stack (Exception Thrown), so need to use scheduled triggers, which I set at 1 second.
  2. A custom workflow cannot call itself, so you need to use 2 duplicated paths which call each other with each event creation.
  3. The button creates the first event in the sequence and passes this to the custom triggers to use as a base line.
  4. The custom trigger then creates another event based on the baseline + the additional days, this new one then gets passed on as the new baseline.
  5. Each trigger checks it is not creating a new event beyond the end date for the sequence. I have limited the end date to a maximum of 2 years beyond the start date to prevent someone setting a date in the next century and flooding the system!

Here is the running demo: https://dave-auld-demo-stuff.bubbleapps.io/version-test/calendar

And here is the page in the editor: https://bubble.io/page?type=page&name=calendar&id=dave-auld-demo-stuff&tab=tabs-1

Hope this helps, thanks for the exercise to get the grey matter thinking :wink:

6 Likes

That’s a really cool solution @DaveA

Thank you for sharing that!

@romanmg Hi Gaby,

This one is maybe a good one for your CoachingBubble newsletter etc. as it demonstrates some of the other features such as custom events, custom scheduled events, passing created things through workflows and how to perform recursive operations.

This is an awesome coincidence as there have been a few threads about custom events this week (including this one) that have prompted me to make that this week’s newsletter topic. Thanks @DaveA. Will PM you about possibly integrating your solution here as an example.

2 Likes

Awwe man this is awesome! Thanks a lot! :beer::slight_smile: Those custom workflows are definitely NOT for the faint of heart. The grey matter started throbbing just looking at them. :fearful:

1 Like