Conditional Logic based on calculation fields [RESOLVED]

Hi, I’m sure this must have come up before, but I’ve not found anything directly relevant in the forum, so I hope someone can point me in the right direction.

I’m making a holiday (time off work) request form.

After picking their ‘start day’ and ‘end day’ (for their vacation), I populate a field called ‘total days requested’ (calculated from the date inputs), it’s just a day count, nothing fancy.

There’s a field called ‘total days allowed’, which is dynamically populated from another form - All working fine.

However, I want to add a bit of conditional logic, and herein lies the problem… I want to ‘show’ a section break that acts as a warning, if ‘days requested’ is greater than ‘total days allowed’.

Ideally the logic would look like this “Show ‘warning’ if ‘total days requested’ is greater than {total days allowed:100}” - But the logic won’t fire based on the merge tag’s associated value. Just wondered if there’s a snippet / wise work-around / plugin that will help me fire logic based on values ‘derived from merge tag fields’?

Help sincerely appreciated

Hi Mark. What you can do is have a hidden Number field in the form set to allow a calculation. The calculation should be:

{total days allowed} - {days requested} (replace with your actual field merge tags.

Then you set the conditional logic based on that field. If it’s less than zero, show the warning. Does that work for you?

Thanks Chris… Makes me feel kinda proud. That’s exactly how I solved it.

1 Like

Glad you found a solution for your setup. If more advanced features/requirements (annual carryover, HR adjustments, user profile display of balances) come up, you might want to look at whether Gravity Flow’s Vacation Request extension could make it an easy baseline to work with.

Regards,
Jamie