Automatic calculations


Is there a possibility to make an automatic calculation in ClauseBase with a value inserted in a datafield? Or do the special functions only work with fixed numbers?

For instance: 15% of #compensation^amount.

Thanks in advance!

Hi Isha,

It is absolutely possible to use calculations in such way! For example,

@percent-divide(15, #compensation^amount)

Would result in 15% of whatever the amount-field of the compensation concept contains.

(More in general, almost anywhere you can insert a “hard-coded” value — e.g., 15 or “alpha” — you can also insert a #concept^datafield at that position.)

Thank you for the quick response!

I receive the following error:
Capture d’écran 2021-06-02 à 12.21.42

I suppose it is only possible with a number-datafield and not with a currency-datafield?

I’ll make a note to perhaps indeed extend this special function to also allow currencies.

For the moment, you can also simply use , for example,

#compensation^amount * 0.15

as an argument in another special function

(or wrapped in {..}if you want to insert it directly into your body text)

That works perfectly, thanks a lot!

Long shot (since the possibilities seem endless) - is it possible to create a condition so ClauseBase takes the highest amount of 2 numbers, and shows this in the document, something like this:

Highest number between {#compensation^amount * 0.15} OR {100 EUR} :smiley:

Something like the following should work:

{#compensation^amount * 0.15 > 100 EUR: #compensation^amount * 0.15 | else: 100 EUR}

(you can also extract the #compensation^amount * 0.15 into an internal snippet to avoid having to type it again — for a simple formula this is probably not necessary, but as soon as the formula becomes more complex, this can be useful)

Thank you, the possibilities really are endless!