Forum Academy Marketplace Showcase Pricing Features

What search syntax do i need to filter this bonus code?

I’m trying to do a search that checks to see if the bonus code is 1) expired (yes/no) and 2) Used by the user (Used by is list of users), if it is expired or previously used by the user then they cannot use it again.

Yep just add Used by contains current user.

T
Learn no code → nocodify.com

I’ve tried that and “doesn’t contain” user and both don’t seem to work. It ends up detecting the bonus and allowing you to use it again regardless if you’ve used it prior

Add the Expired in the search constraint… then the When would just be “Search for Bonus code:first item”

It won’t accept just the first item, it needs me to add something…

Oh i’m sorry, I didn’t realize it was a conditional statement.

Try flipping the expired and first item. So it would be Search for bonuses : first item expired is no

No go. I’ve got it setup so that the button is only clickable once it finds a valid bonus code but this search makes the button immediately clickable and doesn’t change when testing different codes. Here’s how the search looks:

Should the condition be ‘expired is yes’??

Is this condition for when the bonus code is used? If so I think you want it to be when it’s expired then you can’t click the button?

The condition is when the expired is no and the used by current user is no

It’s morning here and my eyes aren’t awake yet - they make the checkbox so small :rofl:

If your conditionals are correct, check the workflow on the button to make sure it’s adding the current user to the ‘used by’ field :slight_smile:

1 Like

There’s no problem with the workflow, its the condition on the button that’s not working

Have you got ‘this button isn’t clickable’ ticked on the appearance tab?

Yes i do. I don’t want it to be clickable until it searches and finds the right bonus code

Well…that all appears to be correct.

I’d say something is up with your data. Check your privacy rules and that the right data is actually in the fields for the bonus code you are testing.

Privacy rules are public so no issue there. Ive tested it and it now accepts any code and even expired ones so the conditional suggested above is not correct.

You could try a different conditional

Add expired = no as a constraint on the search.

Then instead of :first item what you actually want to do is check that there is a code in the database that matches ALL those things. So use :count >0

Basically saying, when you find a code where the value matches the input, and doesn’t contain user and is not expired then you can click it.

It should then not return the same count next time as the count should be 0 because the user is now in the contains field.

I feel like this is getting closer, but not quite there. It remains unclickable until it finds a bonus code, which is good, but i am still able to use the code even though i’ve used it before.
Here’s what my datatype looks like
image

Have you confirmed the current user is actually in the list of users on the code you are testing?

Yes, triple checked it. It is still allowing me to use the code

I’m sure you’ll work it out :slight_smile:

It is sometimes a little hard to give you the solution without seeing everything in the editor.

You could put a RG on the page and bring back the results from the same search you are using on the conditional to visualise exactly what that search is doing.