Dick wanted to create a formula for assessing a downpayment based on a percentage of a bid received at auction. The percentage was 10%. In no event, however would the downpayment be less than $750. How, he asked is the best way to accomplish that.

 

This was a fun one to work on. The answer is there is no 'best way'. Rather there are just good alternative ways of doing it. Here are a few of the (actually many more) approaches. Each is good, and teaches (which is part of this exercise) a different element of 'programming' with Pathagoras.

 

You can use the ‘AskValueInRange’ routine and let Pathagoras determine if  a flat or calculated amount is applicable:

<<*AskValueInRange*!bid!How much bid?*>>

(in document body--)

<<*Options*!bid!0-750/>750*$75/[#Math#Bidder1 Deposit=[Bidder1 Price]*.10]>>.

(Pathagoras can evaluate the Value and use ‘range logic’ to select the proper choice

 

Or use If logic to set the value of two !groups!. In the document, just use the true/false value of the !group! to keep or delete an Optional.

<<*AskValueInRange*!bid!How much bid?*>>

<<*If*!bid!>500,!Percent!=”True”,!Flat!=”True”>>

(in document body--)

<<*Optional*!Flat!*Give me $750>>

<<*Optional*!Percent!: [#Math#Bidder1 Deposit=[Bidder1 Price]*.10]>>.

 

A Negative Optional, based on just the ‘true’ or ‘false’ value of !Flat! would likewise work

<<*Optional*!Flat!*Give me $750/NEGOPT[#Math#Bidder1 Deposit=[Bidder1 Price]*.10>>

 

 

You can just use AskOptions logic:

<<*AskOptions*!bid!Bid less than $75,000/Bid $75,000 or more*>>

 

An answer to the above sets !bid! to 1 or 2 (it's just its position -- 1st or 2nd) and you can use that value in the document body:

<<*Options*!bid!*$750/[#Math#Bidder1 Deposit=[Bidder1 Price]*.10]>>.

 

Or, even simpler, just use a very simple Options in the document body, with appropriate prompts.

<<*Options*Bid less than $7,500/Bid $7,500 or more*$750/[#Math#Bidder1 Deposit=[Bidder1 Price]*.10]>>.