IF Function in CalcStack or Formula Stacks?


(Paul Dennison) #1

Hi everyone,

As we have recently had releases of 2 great new calculation stacks, CalcStack by @willwood and Formula by @1LittleDesigner, which look very good but I am after a particular bit of functionality and wondered if there is a way to do it or it might be available in a future update.

I’m wondering if it is possible to use an IF type function, so that depending on a range stated in an input box a different calculation would be performed.

For example, a car rental business has a standard dailyrate for 1-4 days of hire which would simply be Daily Rate x Number of Days. However if you hire for more than 4 days you get a cheaper daily rate. So dependent on the number of days you hire for you would end up with a formula like this

Price = IF(Number of Days >5, Cheap Rate x Number of Days, Standard Rate x Number of Days)

Is there any way to achieve this as either stacks currently stand?

I couldn’t see any easy way to achieve this in the demo version of CalcStack.

Could there be a way to achieve this by using Siphon stack, which can handle logic?

If anyone has any advice it would be great, thank you


(Will Woodgate) #2

If I understand you correctly, then you will simply want to combine CalcStack and QueryDisplay together:
https://stacks4stacks.com/calcstack
https://stacks4stacks.com/querydisplay

Use CalcStack for a user to adjust the type of vehicle to rent, length of time, extras like insurance, fuel etc. Then enable a query string submit button in CalcStack and pass the calculations over onto a second page.

Based on what inputs / answers CalcStack outputs to the next page, you can then use QueryDisplay to display a product or service that might be suitable for the person to select or buy. QueryDisplay can confidently handle number ranges.

The two stacks are a powerful combination and can give you a very fast and user-friendly setup.


(Konstantijn Van Calster) #3

@pmjd
Hi Paul, I have not yet used the CalcStack but I will make a purchase for sure as most of the stacks/ themes from Will Woodgate are great and support 10/10. The integration with the QueryDisplay stack and the FormPlus stack give you so many options, a real plus :slight_smile:

I have been trying the Formula stack from 1LD but don’t do what I expected, so probably the CalcStack will give you much more for the money and for sure still much more features to come with the next updates (CalcStack).

By the way the Siphon stack from 1LD is great (I can totally recommend it), and if you can get it working with the CalcStack will give you so many possibilities. Let’s me know when you have worked it out, Cheers.


(Paul Dennison) #4

Thanks for the speedy response @willwood will try the two together. I had a sneaking suspicion query stack could help, though would I be right in thinking there would have to be a page reload to get an answer? So you couldn’t edit the inputs live and get a result instantly without having to resubmit the completed info?

@TINO thanks for the info on using Formula, will let you know how I get on with Will’s recommendation :slight_smile:


(Will Woodgate) #5

Query strings can only be appended to browser address bar when a link, button or form is submitted. I should emphasise that this is NOT unique to only CalcStack - it is the way query strings in general work anywhere on the web.

I had experimented with adding support for ‘IF’ statements to CalcStack; to conditionally display calculations or blank stacks based on previous answers given. But there are huge performance implications of trying to read answers ‘live’ and evaluate different conditions on each key press. It is the equivalent of trying to type sidebar content in RapidWeaver while the page is in preview mode - it will constantly try to refresh / reload and become a massive performance drain! It’s just plain ugly for end users…

Currently submitting answers to another page for evaluation with a free stack like QueryDisplay is the best method. Support for conditional displays might get added to CalcStack, but I don’t have any timeline for this yet. It depends on how much revenue the current CalcStack makes and whether we can overcome the aforementioned performance issues associated with live calculations.


(Paul Dennison) #6

Hi Will, is there an option to add date & time inputs to calculations? Or would this have to come from another input source like FormsPlus?


(Will Woodgate) #7

FormsPlus will have you covered.