Subject Re: [IBO] Problem setting filter to TIB_Query
Author Antti Kurenniemi
[snipped some]
>>Now I have a window in an app where I need to set a filter based on the
>>abovementioned fashion. I suppose I could do it also by creating the query
>>anew instead of making such a funny filter, but my question is, should it
>>work as a filter? Because with IBO 4.6A it doesn't - the filter string is
>>parsed somewhere, and becomes as follows:
>>
>>id IN (SELECT, custid, FROM, custtoclass, WHERE, classid, IN, (, 1, 2, 3))
>>
>>which obviously fails. So, a little help: is this IBO being too clever, or
>>me? If it's me, then I'd appreciate suggestions how to do it right.
>
> I think it should work as a filter, although you WOULD need to have
> correct correlation syntax for *any* multi-table queries (which you
> don't).

Oh, I trimmed it to just the filter part of the string - I have a full query
(select this, that, those from customer), and this is just the filter part
for IBO. It works really well with simpler strings, like if I just set

id IN(1, 2, 3)

...or...

sizegroup>2


> You are starting with a completely unqualified main query

No, I'm just explaining myself badly. I know I could get this to work if I
just set the whole main query to include just the set I want, instead of
using the filter, but I'm just trying to see if this should also work in IBO
as a filter.


> If you must do this, make sure that the entire distribution is fully
> qualified first:
>
> Main query:
> SELECT
> Customer.id, Customer.name FROM customer
>
> Filter would have to resolve as:
> [WHERE] Customer.id IN
> (SELECT custtoclass.custid FROM custtoclass
> WHERE custtoclass.classid IN (1, 2, 3))
>
> If that still causes problems for the parser because of the subquery,
> you might get it to work if you ensure that the entire filter string
> is enclosed in brackets as well, i.e. so the filter string looks like
> this:
>
> '(Customer.id IN
> (SELECT custtoclass.custid FROM custtoclass
> WHERE custtoclass.classid IN (1, 2, 3)))'

Nope, still the same, IBO adds commas in between every token even after
adding the full table specifiers and additional brackets. It the fails with
an expception:

"Invalid syntax: extra or missing parenthesis"

And it's not wrong number of parenthesis but the added commas. Should I make
a test case? Where do I post it, I've never done that before?


Thank you, Helen.

Antti Kurenniemi