We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Evaluating a String as Boolean

jdthedj
jdthedj asked
on
Medium Priority
310 Views
Last Modified: 2010-04-04
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.
Comment
Watch Question

Commented:
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

Author

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.

Commented:
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.
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

Commented:
To: ZifNab

Hi Zif !

What is Rx Library ?

Author

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

Commented:
? 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.

Author

Commented:
Thanx for the tip, Zifnab - I'll check it out.

Commented:
And, tried out the Rx library? What do you think about it?
c.u.'ll

Author

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
Commented:
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.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

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
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.