Search these areas:
Support Forums
Product Info

-DataWeb: What's New
-Creating an Application
-The DataWeb Designer
-Application Management
-Data Tables
-Data Tables
-Data Analysis
-Object Model
-Full-Text Search
-Domain and Email Hosting
-HotBlock Modules
-Account Management
-New Responsive UI Module

DataWeb Help
Support Forums
Script Library
Knowledge Base

Home > Support

Support Forum

Filter syntax question
droberts1234 asked:
on 2005-09-28 10:36:14, droberts1234 asked:
I have two preset filters that work fine by themselves. One was written with the preset filter wizard:

=Activty BETWEEN 2 AND 4

The other is from the row level security script in the script library:


What is the syntax to combine these two filters to show only records with activity between 2 and 4 AND the user has permission from the script?

Thanks again for your help.  

  on 2005-09-28 10:51:05, psiegel (DataWeb) responded:

  Hmm. This can get tricky. Where do you need the filter to live: on the field itself (syntax #1) or in-page (syntax #2)?  

  on 2005-09-28 10:55:32, droberts1234 responded:

  I need to filter a view with it. I currently am using these filters in the preset filter area in the design view. I don't necessarily need to use BETWEEN. IN would work as well since I am looking for Activity codes of 2, 3 or 4.
  psiegel responded:
  First off, I apologize for taking so long to respond to your question. I have to admit that in attempting to answwer it, I learned a few additional things about our filter syntax. There is more to it than meets the eye.

Basically, I'm using a technique here that builds the preset filter "on-the-fly" via script. I've modified the getfilter function a bit to do for you what you want and what you probably want as well.

    var andString = " AND ";

    var filt = "(Activity BETWEEN 2 AND 4)"; // starting filter

    function getFilter(fld)
        var returnValue = "";
        var errorCondition = false;
        if (User.isAdmin()) // Admins can see anything
            returnValue = "";
            var rs ="AddressBook","Dept","UserName='" + + "'");

            if (rs.getCount()>0)
                if (rs.Dept!="")
                    if (filt!="")
                        returnValue = returnValue + andString;
                    returnValue = returnValue + fld + "='" + rs.Dept + "'";   
                else // fail-safe for users with no dept
                    errorCondition = true;
            else // fail-safe if user is not in AddressBook
                errorCondition = true;

            if (errorCondition==true)
                if (filt!="")
                    returnValue = returnValue + andString;
                returnValue = returnValue + "rowID=0";
        return returnValue;
    filt = filt + getfilter("Dept");

    filt = "=" + filt;

The only thing left to do is to set the preset filter for the dataregion to the following: #filt#

The additional scripting protects the data by appropriately handing a couple different error conditions that would display inappropriate records to the user.
  psiegel responded:
  Dataweb considers this issue closed.
If you have additional questions or comments about this issue, please open it again.
If you have questions about a different topic please open a new support question.

Dataweb Support
  Please Log On
or create your own DataWeb Account.
Affiliate | Partner | Terms of Use | Privacy Policy | Contact Us | Pricing | Bring DataWeb In-House    
DataWeb, 720 North 10th Street, A #145, Renton, Washington 98057 *425-583-5970* Fax 484-770-4706* Email Us