Check if a combination of values exist

I have a page where users can sign up. I can check if an emailaddress already exists.
I also have four categories ( 1, 2, 3 and 4) where users can sign up for, but only once.
As stated, I can check if the emailaddress already exists, but is it possible to check if the emailaddress already exists combined with the category, so that the user is only able to sign in once for every category and refuse if they want to sign up for a category they already signed up for.
Is this possible and if yes, how can I get this done?
Just pretend I am a 6 year old to explain :rofl:

You can filter a query by both category and email and check if the user exists there.
Then with a condition - either run the insert or return an error response, depending on if the query returns a result or not.

So if I understand correctly I make a query (name: qryexist) like this:

Then ?Condition {{qryexist}}

  • then steps:How do I get a message to the user in this case?
  • else steps: database insert and all the rest

Yes, I know I am being a nuisance again :smiley:

Thanks for the efford, but this is not quite a “6 year old” level. This is way above my comprehension level. So I give up and will just restrict the user to participate in only one category.

I’m sorry i don’t know how to explain this in a more detailed way…
Maybe you should check the docs so you can understand the fundamentals before jumping in more complex server actions.

I checked all docs I could find and the ones you pointed out to me. The way they are written are above my comprehension level most of the time. Learning curve is sometimes far too steep.
Never mind.

Ok, I have it working. May be not the best solution, but a working solution.

Server Actions

I am assuming you already have an insert or update form on your page.
In your existing form server action:

  • Make a database connection if not already there.
  • Make a database query. Set conditions for the formfields to be compared with the database. In this case I want to make sure that one can only insert images into one category.

  • Right click Database Query > Core Actions > Condition
    • Hit the thunderbolt and select the query. Add an ! before query1 so it reads {{!query1}}
  • Under “then” step set your actions to execute when conditions are NOT met or move them from your existing Server Action.
  • Under “else” step select Core Actions > Response
    • Give it a name
    • Set status to 400
  • You may set a text. (NOTE: this tekst will not show on your page).

2_response

  • Server Action Steps are done now.

APP connect

  • Select App and hit the plus sign
  • Select Components > Notifications
  • Select notifications and adjust it to your needs
  • Select you form and with your form selected click on Dynamic Events > Server Connect > Error.
    • Hit the (former) thunderbolt icon and select notifies > some notification
  • Set the warning notification properties (between single quotes)

• Now the Form Action will not be executed if the combination of mailadres and category are in the database already.

If someone cares to comment or has a better solution, please feel welcome to tell me.