Check if data is available in database (return true/false)

Hi everyone,

I am creating an app in which while checking out, users can generate a unique code that, when shared with another user provides both of them a discount. I have figured out how to create a code and store it in the database etc, here’s where I am stuck.

Whenever a person types in a code and clicks the button add code, I need the logic to check if it is available in the database and return true/false which will send a dialog. The code is stored in a page variable named disc_code. I know the Lookup command and this as well (IS_IN_ARRAY(VALUES(data.find_order),pageVars.disc_code) but am unable to implement it.




I know this is very basic, but I am an interior designer, not a developer even though thanks to Appgyver and the amazing community I have created an app that exceeds all my expectations.

Appreciate any and all help. @Mevi @Mari

Hi,
Why do you use JavaScript and not a formula that looks at your database?

1 Like

Thanks for the reply, where am I supposed to enter the formula from? do you mean using the Get Record flow function? I am pretty new to this, hence I might need more basic instructions on this one. sorry.

Thanks for the suggestion, I just figured out (still not sure) that this should be my logic

Need to figure out the code, the current code has some problems

It miss a condition in your IF formula. Find == something

Thanks a ton for the assistance. Here’s the formula that worked for me IF(FIND(data.find_order, item.disc_code==pageVars.disc_code), true, false)

Have a great rest of your day.