Jump to content
  • 0
Sign in to follow this  
TessW

Limit searching

Question

I want to limit searching for non paying users. Non paying users would be able to search up to 10 times a month. Paying users would be able to search as many times as they liked. Is there a way to do this?

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

I have an Idea for this one but Its a bit tricky to set-up

first, you will have to create a set-up where you are going to use a seperate search form results form. Please refer to this article:

https://howto.caspio.com/tech-tips-and-articles/tech-parameters/how-to-separate-search-page-and-results-page-into-two-different-webpages/

You will also need an extra table with similar design to your main table. Use that as the data source of your submision(search form).

You will also need an authentication for this workflow. Even if your users are non paying, they should still have an account first before being able to access the forms.

You will need to have an extra field on your users table which will mark which is paying and which is not. (preferably a text 255 which says "paid" or "free")

Also, on your submission form, create an extra virtual field, set it to a calculation value that will check if the current users are paid users or not. If it determined that the users are non paying, it will count how many searches are conducted within the month. It can be done by using a conditional statement that returns the URL of the report page if the conditions are met properly. Otherwise, redirect the users to a different page which has a message that they have exceeded their limit search for the month.

 

Share this post


Link to post
Share on other sites
  • 0

As for the formula, you may refer to this one:

Case 
when [@authfield:Role] = "paid"
then"URL for report page"
When (Select count (Id) from "extra_table_for_subform" where DateDiff(month, date, SysDateTime())) = 0) < 10
then "URL for report page"
else "URL for notification message about limit"
end

 


image.png.efccb06c91669a942b000773baf26642.png
LAstly, on your destination after submit, select the "Go to a new page" then use the virtual field as value along with the parameter

I hope the idea helps.
 

Share this post


Link to post
Share on other sites
  • 0

I understand the theory and have started to apply it. However, the formula doesn't seem to work. I have as follows:

CASE
WHEN [@Virtual9]='Paid' THEN "https://c1ace471.caspio.com/dp/00118000bee75c1ed6e84ba6b6c4"
WHEN [@Virtual9]='Free' THEN (SELECT COUNT (Virtual10) WHERE DateDiff(month, date, SysDateTime())) = 0) < 10
THEN "https://c1ace471.caspio.com/dp/00118000bee75c1ed6e84ba6b6c4"
ELSE "https://c1ace471.caspio.com/dp/0011800083f54cec70c44a2488f7"
END

The relevant fields are present, the pages are created, and I reference the virtual field in the destination. But nothing happens when I select submit (no error or anything, just stays on the submission form). I suspect it is the URLs. How should I be writing them to make the redirects work?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...