Who wants to have fun with my IF formula? 😆

Guys (are there any ladies out there by the way?),

I have a list of objects containing up to 3 keywords (example below, only two were set by user)

{token: "stay"}, 
{token: "sports"}, 
{token: ""}

I need to use them as criteria (dynamic values) to find the matching lists of objects in a document.

IF matching list(s) is/are found, I’d use an Update record flow function to increment the count by +1 in each relevant list.
IF no matching lists, I’d use the Create record function to create said list(s) with the 4 property object and a starting count at 1.

After nearly two days, I still have a blank page with the IF function, yet I’ve used a granular method where I address one goal at a time. I know I need to use IS_IN_ARRAY(), SELECT() and others of those kinds but I can’t even complete the first formula. :unamused:

Anyone feels inspired by this challenge? Thanks in advance.

I mean, there are a few ladies among the staff and also among users as well of the platform, luckily.

This one is a truly fun task. Though I feel like there is a slight issue.

What do You compare to? What do You want to check first?

I imagine You have a page variable where they set the specific service, which has properties like “type” (value: gastronomy), “country” (value: USA), “price” (value:49)

So first I would do this:

  1. get the record where do i want to check the presence of my pageVar. Let’s call this data variable “findIn” and the page variable “findThis” (properties: type, count, country, curr, price).
  2. Make sure the page variable has all properties set correctly
  3. IF flow formula binding:
IS_IN_ARRAY_BY_KEY(LOOKUP(data.findIn, pageVars.type), "country", pageVars.findThis.country)

*I am not sure, maybe You have to put the pageVars.type into a STRING() formula like this: STRING(pageVars.type)

This would return You a true / false value and this set You on the correct path to either update the record by increasing the count in Countries or creating a new country.

Did I get Your request right? Or was it about also the categories themselves?

Thanks as always Mihaly!

I think I got it, the true/false check technique.

But let me share some context here for better understanding.
I need to create a counter, where +1 is added to a count property each time a user creates an input with 4 criterias: Categories (1 to 3 tokens in a list: stay, sports, adventure, wellness…), Country, Currency, Price. That involves creating or updating lists of objects in the counts document.

On an input page:
Users input a few info to the database, including country and currency values, whose bindings are like so:
A first save Creates a new record (new Provider doc)

In a 2nd step of same page, price value binding

And input a list of 1 to 3 token texts under the category property:


On 2nd button click, users update previously created Provider doc with new ‘service’ data.

All values are available for further bindings from Provider and Service data variables already.

On the same 2nd tap, I need to check if the lists of objects in counts document match the primary criteria (one of those 3 token texts), if so, does the matching list contain an object whose properties match all 3 secondary criteria country, currency, price input by user?

IF match primary and secondary criteria, then Update with a +1 to the count property:
Else, Create an object with count, country, currency, price when list name already exist or Create an entire list with object when list still inexistant.

Challenge is, there are multiple criteria to check in the IF flow formula with ARRAY and LOOKUP.

Not looking at this in detail, but for multiple criteria you are probably going to want to be using and / or somewhere. Not sure if you know the below;

|| is OR
&& is AND
== is EQUAL

1 Like

Indeed planning to test out with and/or within the IF as well as cascading IF conditions.

Will report on my findings.

Pausing on this development angle.
Intellectually exciting and challenging but too time consuming.

I’ll use an relational database for my counter. Much easier to LOOKUP properties and edit them.

Thanks anyway.