Simplifying Formulas

  • benjabievres-1306184041447424020

    benjabievres

    5 months ago

    Hello, I want to do a Formula that checks the value of a variable and returns true or false, for an Array Filter.

    Users have a select box where they can select: on, off, all

    - when it's 'all" => always "true"
    - when it's 'on' => item.active=true => "true", item.active=false => "false"
    - when it's 'off' => item.active=false => "true", item.active=true => "false"

    I built the formula you can see on the screenshot, but I wanted to know if I could have done simpler.

    Can you please help me?

    Thanks

    Benjamin
    1306184041774452797-image.png
  • martinf4630-1306197241551126530

    MartinF

    5 months ago

    You can create an object with key-value pairs, this can simplify a little.
    1306197241572233236-CleanShot_2024-11-13_at_10.00.312x.png
    😍1
  • Not sure if that helps any
  • benjabievres-1306198962554015756

    benjabievres

    5 months ago

    @MartinF I really love this idea!!
    👍1
  • benjabievres-1306233368626856000

    benjabievres

    5 months ago

    Hey! I also created Custom Formulas to make the main formula simpler.
  • martinf4630-1307027699289555034

    MartinF

    5 months ago

    Awesome, sounds nice and clean.