Evaluating a String as Boolean

Hi

I have a rather tricky problem.  I don't want to use SQL, but I want the result of a function to evaluate as true or false.
The user picks a fieldname from a list, then an operator (=,<>,>=,<=), then types in the answer required.  I want to evaluate the concatenation of the above to a Boolean result.

I think I would need to make the whole expression into a string because I will need to use the As operator when I get the fieldtype from the field, and then cast the typed in criteria to the correct type.
I don't want to type multiple lines to cater for every possible combination of results, so I need an Eval(String) type of function.

Any help gratefully received.  I am using D1.
LVL 3
jdthedjAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

itamarCommented:
I am suposing that you need this to select registers from a Table, right ?
What about using the Filter property of TTable ?
You can set the expression "on the fly".

P.S.: I am not sure if you have this property in D1
0
jdthedjAuthor Commented:
Thanks for the reply Itamar.  No, filtering is not an option with D1. The reason I don't want to use SQL is because I want the user to be able to edit the data returned, and SQL is often read only.
I am basically trying to build a filter which will work on the user's choices, but I can't work out a simple way of getting a Boolean answer from the pseudo "Where" statement.

0
ZifNabCommented:
Hi jdthedj,

You have Rx Library not?
Why don't you use that filter? Isn't it usable in D1, supose it is!

c.u. Zif.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Pegasus100397Commented:
Heya Jdthedj,

  I love these types of questions (NOT!) hehehahaha
Anyways, if I understand correctly you want to do comparisons of fields against data in a table right?

Such As: Table1
Name        Points
---------------------------
Itamar       3000
jdthedj       2500
ZifNab      4000

and construct a string such as: "Points >=3000" and have it return TRUE if *any* (no matter how many) records match that criteria and FALSE otherwise, is this correct? If so I have a nifty solution as I recently (in the past month) had to build similiar functionality into my app. Let me know if this is what you are trying to accomplish.

Good Luck With Your Project!
Pegasus
0
itamarCommented:
To: ZifNab

Hi Zif !

What is Rx Library ?

0
jdthedjAuthor Commented:
Hi Guys

Thanks for the replies.  

Zifnab - I also wonder what is Rx Library??
Pegasus - I think what you're talking about is what I need.  Basically the ap I am working on is like the Database Desktop, but with more functionality.  It allows sorting on any field indexed or not, and that part works, but I have also placed 3 fields on a form above the grid as outlined in the original question.  I would then make a string out of the combination of the 3 fields which would need to evaluate as Boolean.
The resulting string would be Fields[cField.ItemIndex].AsString >= "FieldValue" etc.
I would be grateful for your solution.

JD
0
ZifNabCommented:
? Don't you guys know about Rx Library? Strange...
It's a freeware library with lot's of interesting stuff. Full source!!! It's for D1, D2, D3. Handy, isn't it? I think it are about 70 components, ... Pitty though the help-file is in russian ;-(. But the components are self-explaining.

I suggest that you all have a look at it. But look out when installing the stuff. I always recommend to take a copy of your library, even it looks very professional stuff. There always can go something wrong.

Here is the url :

http://rx.demo.ru

Those guys really did a great job...

You can use there filter to filter through a table, I think it's even faster (I'm almost sure) ....

Have fun with it!
c.u. Zif.
0
jdthedjAuthor Commented:
Thanx for the tip, Zifnab - I'll check it out.
0
ZifNabCommented:
And, tried out the Rx library? What do you think about it?
c.u.'ll
0
jdthedjAuthor Commented:
Hi ZifNab

I've downloaded the RxLibrary and it's great - the filter does just what I need.  If you want to turn your comments into an answer, you deserve the points for this one.  Thanx again

John D
0
ZifNabCommented:
Hi John D,

Well, I'll answer the question :
Try the freeware filter in the RxLibrary, you can find this library at http://rx.demo.ru.

My opinion is also that I don't diserve the full points, I didn't make the component. So, if it's possible and you think the same, I don't mind that you reduce the pints of this question.

Glad I could help you. Have fun with the Library!
c.u. BanZif.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jdthedjAuthor Commented:
Thanks BanZif.  They won't let me reduce the points, but I have a very happy client, so I don't mind giving you the points.

John D
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.