Jump to content
  • 0

Search for negative and positive records


imJihyo

Question

Hello! I've been looking for possible solutions, but I can't seem to find any. Is there any way to make a field in search form to look for either positive values or negative ones? I tried working with criteria but can't make it work. Any help would be appreciated! <3 I'm working with an integer field btw.

Thanks in advance!!! :wub:

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hi @imJihyo, this took me some time to figure out as well! I noticed Caspio has a "range" comparison type in search fields.

Basically, what you need to do once you've added the field to your search fields, is choose from the radio button, dropdown, or list box form elements then check the comparison type. You'll see the "range" option there. After that, you just need to configure what you consider is positive or negative. Here's what mine looks like:

image.png.88d1769c8db6c6c2e9a606a38ced8067.png

My "negative" values never exceed -700 and positive ones don't exceed 30000 so that's what I indicated.

 

I hope I helped you figure out how to do it B)

Link to comment
Share on other sites

  • 0

I think you can do this with a combination of Criteria, Virtual Field, and Rules. I haven't tried this, just a thought in my head.

  • Split the Integer field into two criteria. For both criteria, set the Form Element to Text Field. Go to the Advanced Tab, check the 'On Load: Receive a Parameter'. Set Default Value to 0. 
  • For one criteria, set Comparison Type to Greater Than. For the other, set it to Less Than. 
  • Use workflow in this article to hide the integer field and the criteria:

https://howto.caspio.com/tech-tips-and-articles/how-to-hide-fields-in-datapages/

  • Add a Virtual Field dropdown or radio buttons with values of Negative and Positive for the users to select to search for Negative or Positive values. 
  • Create a new Rule. For Criteria, add the Virtual Field = Positive. For Action, Disable the Integer Criteria with the Less Than comparison type.
  • Create another rule for when Virtual Field = Negative. For action, Disable the Criteria with the Greater Than comparison type.

When you disable fields, they aren't used in the search filtering. So the idea is to split the integer into two criteria, where one is searching for values less than 0 and the other the opposite. Then use a virtual field to delineate which criteria to disable. 

 

Link to comment
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...
×
×
  • Create New...