How to use IN in Filter from a Clientdataset?

Asked

Viewed 205 times

0

According to the documentation of the Embarcadero I can use IN in the Filter of a Clientdataset, see example taken from the documentation itself:

Country IN (SELECT Country from Country where Currency = '_Franc')

But when I do Filtered:= True in my Clientdataset with Filter := id NOT IN (22,43) get the bug:

Filter Expression incorrectly terminated

By mistake I can say that the problem is the filter, but I would like to understand, if there was an example in the documentation, what is wrong? What’s the right way to do it?

Dataset has 18 records, has a field with name 'id' and I know that among these 18 records there are different ids and that fit the condition.

I need to filter the Dataset, I can’t filter the Query which I use to fill it.

2 answers

1

Good morning,

Diego, there are some particularities according to the type of Dataset, and some options are only available for some Datasets. If you notice correctly, the excerpt you quoted is in examples for a Tibtable. I think for a Tclientdataset, if it’s a simple filter like the one you posted, the alternative would be to use the same Or operator or use code in the Onfilterrecord event instead of filling the Filter property.

I hope it helps

  • You are right, I had not attempted this detail, my fault in this part. However, I managed to use. The error was in the way I was doing. It worked when using the Filter := NOT (id IN ( 22 , 43 ) )

  • 1

    Now I just don’t know, I can answer and accept my own answer to close the question?

  • @Diego_f can yes, including this answer, in my opinion, would be better as a comment.

  • 1

    @Melissa I can only accept the answer in 2 days, but it’s done. Thank you.

0


The problem was the filter expression, worked after I used it as follows:

Filter := NOT (id IN ( 22 , 43 ) )

Browser other questions tagged

You are not signed in. Login or sign up in order to post.