473,320 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

boolean expression evaluation algorithm

A client wants have acess to an online databases records controlled by group
strings and evaluation strings e.g., each use would have in his client
record a group string like this:

[ROOT][ADMIN][ACCOUNTING][ABC PRODUCTS]

And each record in a database would have an evaluation string like this :

([ROOT] OR [ADMIN] OR [ACCOUNTING] OR [FINANCE]) AND [ABC PRODUCTS] OR
[ACME]) etc.

No limit to the number of groups or the complexity of the evaluation
expression. I need an asp function that I will just pass the group string
and the evaluation string and it will return True or False as to whether the
client can view that particular record. I can't find anything in ASP on the
internet though this must be a common database control method for
non-browser applications? Has anyone done anything like this in ASP? Thanks!
Jul 19 '05 #1
1 2677
<<
A client wants have acess to an online databases records controlled by
group
strings and evaluation strings e.g., each use would have in his client
record a group string like this:

[ROOT][ADMIN][ACCOUNTING][ABC PRODUCTS]

And each record in a database would have an evaluation string like this
:

([ROOT] OR [ADMIN] OR [ACCOUNTING] OR [FINANCE]) AND [ABC PRODUCTS] OR
[ACME]) etc.

No limit to the number of groups or the complexity of the evaluation
expression. I need an asp function that I will just pass the group
string
and the evaluation string and it will return True or False as to whether
the
client can view that particular record. I can't find anything in ASP on
the
internet though this must be a common database control method for
non-browser applications? Has anyone done anything like this in ASP?
Thanks!


Here's something like what I've often used to make sure someone is
allowed to view a page:

' If not valid user level.
If Not jpsvbIsInList("User;Admin", Session("UserLevel"), ";", True) Then
Response.Redirect mstrSiteMainSecure & "/login.asp"
End If

And later in the page's SQL statement I might actually used the CustID
of the user too.

And here is the custom jpsvbIsInList() function:

Function jpsvbIsInList(pvarList, pvarItem, pstrSeparator,
pbolIsCaseSensitive)
' Purpose: See if item is in list.
' Remarks: Typical separator can be ; or even multiple chars such as
comma space.

' Dim var.
Dim varItem
Dim varList
Dim intCompare

' Set var.
' (Uses VB constants.)
varItem = CStr(pvarItem)
varList = CStr(pstrSeparator & pvarList & pstrSeparator)
If pbolIsCaseSensitive Then
intCompare = vbBinaryCompare
Else
intCompare = vbTextCompare
End If

' Return val.
If InStr(1, varList, pstrSeparator & pvarItem & pstrSeparator,
intCompare) > 0 Then
jpsvbIsInList = True
Else
jpsvbIsInList = False
End If
End Function

Hope this helps,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
Classic ASP Design Tips, ASP Web Database Demo, ASP Bar Chart Tool...
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: greg | last post by:
Discussion is invited on the following proto-PEP. ------------------------------------------------------------- PEP ??? - Overloadable Boolean Operators...
9
by: John Ratliff | last post by:
Does C++ employ lazy evaluation of boolean conditions, e.g. can I do the following safely if ((obj != NULL) || (obj->someMethod())) { // blah blah } Or will I get a segfault if the obj ptr...
2
by: webposter | last post by:
Hi, I am looking for information on a data structure (and associated algorithm) to do short-circuit evaluation of boolean expressions and haven't found a single one even after googing for two...
3
by: Coco | last post by:
Hi! Does c# has any class method that will be able to evaluate a given string e.g ((True && False) || (True && True)) and return the result in boolean for this case is true Thanks!
5
by: Railgunner | last post by:
I am looking for a routine that can evaluate boolean expressions like: IF/ELSE-IF (X1=X2 AND (Y=1 OR Z1=Z2)) IF/ELSE-IF (A$='Y' AND B=1) OR (C=1 AND D>E) etc. I can handle...
53
by: Killer42 | last post by:
Hi all. We have a thread Need Boolean Expression Evaluation Routine - Reward in the VB forum which may interest the wider development community. Please have a look. The upshot is that...
4
by: Greg Corradini | last post by:
Hello all, I'm having trouble understanding why the following code evaluates as it does: True -1 In the 2.4 Python Reference Manual, I get the following explanation for the 'and' operator...
33
by: Stef Mientki | last post by:
hello, I discovered that boolean evaluation in Python is done "fast" (as soon as the condition is ok, the rest of the expression is ignored). Is this standard behavior or is there a compiler...
2
by: Workaholic | last post by:
Hi, I have an application which is reading a boolean expression from an external file into a string. The string will equal something like "1 = 1" or "0 = 1". I need to be able to evaluate the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.