sorry I meant use the replace() function to change the {} values, NOT the replicate() function
Main Topics
Browse All TopicsWe have a database with three tables: Rules, Conditions, Actions. I cannot change with database and I have to sort thru the information in it. I need to be able to filter thru the "Rules" table, check to see if my information meets any of the "Conditions" and if it does apply the "Actions". The problem is that the condition expression in the Rules table field could look something like this: "{AID_Sam} AND NOT {AID_BOB}" . {AID_Sam} is a reference to the "Conditions" table ID field "AID_SAM". The definition field would be [AuthorID] = "SAM". In other words the condition is actually "[AuthorID] = "SAM" AND NOT [AuthorID] = "BOB". I doubt this makes any sense, but I need to be able to parse this out to determine if the Rule applies and the action, that I need to take. Maybe I am making this harder that it needs to be. Any help would be greatly appreciated.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
You right, I have been using the replace() function.
I loop through the condition to create the expression, then test it againt the data to see if it applies....Then, I go to the action and do the same thing. The action can also have several conditions embeded in it to form the expession. I was hoping that there may be some easier way. Any thoughts?
Business Accounts
Answer for Membership
by: kmslogicPosted on 2009-05-03 at 21:43:51ID: 24292574
I think you have it right. There must be some existing code (from a previous employee?) to parse and lookup the embedded values in rules.
To do this you'll need to write some Visual Basic code to parse out the curly brace values and then look them up int he conditions table to turn them into valid SQL. This instr() function will allow you to find the opening and closing curly braces and you can extract what's in between with mid()
Another approach which seems kind of fun (it would help to see at least a portion of your three tables) would be to read the conditions table into arrays and then use the replicate() function to change the {} values to valid SQL