How do we use expression ?

Created on 23 June 2022, over 2 years ago
Updated 25 July 2023, over 1 year ago

I'm trying to use an expression with an if to avoid divide by zero exceptions in my Drupal logs.

Following the documentation on the repo: https://github.com/andileco/eval-math

I have something like this:
if(@my_field=0, 0,@another_field / @my_field)

But it doesn't work. Any idea how to use expression and if ?

💬 Support request
Status

Closed: works as designed

Version

3.0

Component

Documentation

Created by

🇮🇱Israel heyyo Jerusalem

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇹Italy dkatena

    Sorry if I reopen the topic, but it seems relevant.
    I tried the if function (ex: if(1=2, 2+2, 5+5) ) but I have this error:

    "Andileco\Util\EvalMath\Exception\InternalErrorException: in Andileco\Util\EvalMath\EvalMath->nfx() (line 367 of /vendor/andileco/eval-math/src/EvalMath.php)."

    Drupal 9.5.11
    PHP 8.2.24
    View Simple Math 3.0.2
    andileco-eval-math/3.0.1

    what am I doing wrong?

    PS: Are you planning to add the ceil and floor rounding functions?

    Thanks very much

Production build 0.71.5 2024