Database query - hide or delete data for a specified user

Hey Guys - I’m seeking some support with a database query. I have created a repeating group to display Offers/Vouchers on a webpage for a user that is logged in. The user can view the details of the offers and press redeem to generate a unique code.

I am trying to create a workflow which prevents a user from redeeming an offer more than once. So in essence, I am looking to delete or permanently hide that offer for a user once they have redeemed it.

The problems I am facing are:

  • I don’t know how to delete or hide it for a specified user, without deleting the data entry from the database
  • I’m only able to hide an offer temporarily, i.e. when I try logging out and logging in with the same user credentials again, the hide action is not saved and the offer reappears

If anyone could offer support or some words of wisdom on this, it would be much appreciated! Many thanks!

One way is like this:

On the user’s make a new database field called “used_coupon_codes” which is a list.

When the user redeems a coupon code add the coupon code uniqueID to the list of used_coupon_codes for that user.

Check before applying a coupon code that the user does not have that unique ID in their list. (Or in your case you said you don’t want to display the coupon to the user)

1 Like

Many thanks, that is exactly what I was trying to achieve!