Forum Academy Marketplace Showcase Pricing Features

If only there was an if statement

Hi bubblers.
Noob adapting to no code programming here. I am trying to figure out how to do another thing that is would be a simple operation in any coding language but seems hard to figure out in bubble.

Here’s the gist:

  • I wan to create a list of employees with hiring dates that have a month = to current month and next month.
  • Its not at all clear how to do an operation on the date like this inside of a search or a filter. I need to be able to examine the month component of the date of hire inside of the search function. Cant seem to do that.

I assume what you mean is that you want to generate a list of Employees who’s hiring dates are in either this month or next month, as opposed to dates which have a ‘month’ equal to the current month or next month (which would include dates from any year i.e. November 2004, November 2012, December 1999 etc.)

If that’s right then you can do a ‘Search for Employees’, with two constraints:

month ≥ Current Date/Time: rounded down to Month

month < Current Date/Time: rounded down to Month: +(months) 2

If you did actually meant that you want to generate a list of all Employees who’s hiring dates in in November or December (from any year), then you’d need to do that by applying an advanced filter after the search

1 Like

Thanks for the reply @adamhholmes.

That’s incorrect. I could have explained that better. If it was that simple the available operators would certainly suffice.

I want to take an action at the employee’s anniversary each year. So I’m looking for the set of employees who have a hiring anniversary within the next month or 2.

1 Like

Hi there, @mike26… when it comes to something like what you have described, I am never opposed (right, wrong, or indifferent) to adding a field here and there, especially if it makes it possible to avoid advanced filters.

So, if the anniversary month is that important in your app, then I might have a field to store that month (which I would extract from the anniversary date when that date is saved, of course). With that field in place, a search for employees with a constraint of anniversary month = Current date/time:extract month merged with a search for employees with a constraint of anniversary month = Current date/time +(months):1:extract month would produce the desired result.

Anyway, you may not want to go this route, but I didn’t think it could hurt to throw it out there as food for thought.

Best…
Mike

Okay good idea @mikeloc @mikeloc perhaps more elegant that what I’ve come up with here which is admittedly quite unsexy:

I can accomplish this this using two backend workflows, call it step 1 and step 2
Step one: schedule step 2 on a list of employees
Step two add employee to the list of employees only when employee's date of hire:extract month is current date:extract month

Since I have more flexibility in the only when field than i do in the search for building operations into the constraint.

Well, I can’t imagine anyone is going to come along and describe my suggestion as sexy, either. So we’ve got that going for us, which is nice. :wink:

I would just go with a repeating group with a data source of the merged searches I mentioned, but whatever gets the job done, eh?

Thanks @mikeloc i took your suggestion in principle. I added a field with the full date of the next anniversary milestone. i set that filed when the employee is created and update it when the action is scheduled. with the whole date sitting in the db its easy to do the needful in the app. good thinkin…thanks again.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.