Re: Question: How to build complicated queries?

2002-02-03 Thread Derek Atkins

Dave Peticolas <[EMAIL PROTECTED]> writes:

> The operator for the very first term in a query is ignored.
> So you choose QUERY_AND when you add the second one and you
> should get what you want.

Ahh, thank you.  That was the key piece I was missing.  Is this
fact documented anywhere?  Even after re-implementing it I didn't
even realize that the first term's QueryOp was ignored! :)

> dave

-derek

-- 
   Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
   Member, MIT Student Information Processing Board  (SIPB)
   URL: http://web.mit.edu/warlord/PP-ASEL-IA N1NWH
   [EMAIL PROTECTED]PGP key available
___
gnucash-devel mailing list
[EMAIL PROTECTED]
http://www.gnumatic.com/cgi-bin/mailman/listinfo/gnucash-devel



Re: Question: How to build complicated queries?

2002-02-03 Thread Dave Peticolas

On Sun, 2002-02-03 at 14:07, Derek Atkins wrote:
> Dave Peticolas <[EMAIL PROTECTED]> writes:
> 
> > > For example, I want a query to be:
> > > 
> > > a && (b || (c && d))
> >
> > To ensure grouping in a complicated expression, it's
> > best to combine two simpler queries together with
> > xaccQueryMerge. So you might create the query for
> > c && d, and a query for 'b', and combine them, and
> > then combine the resulting query with one for 'a'.
> 
> Ok, if I'm going to create the query for, e.g. c AND d,
> what's the right way of doing that?  In particular, I
> only want one logic operator, but I have to supply one
> with each term.  Do I need to create both the 'c' and
> 'd' terms with AND, or do I put 'OR c' and 'AND d', or
> is there something else what I'm missing?

The operator for the very first term in a query is ignored.
So you choose QUERY_AND when you add the second one and you
should get what you want.

dave




signature.asc
Description: This is a digitally signed message part


Re: Question: How to build complicated queries?

2002-02-03 Thread Derek Atkins

Dave Peticolas <[EMAIL PROTECTED]> writes:

> > For example, I want a query to be:
> > 
> > a && (b || (c && d))
>
> To ensure grouping in a complicated expression, it's
> best to combine two simpler queries together with
> xaccQueryMerge. So you might create the query for
> c && d, and a query for 'b', and combine them, and
> then combine the resulting query with one for 'a'.

Ok, if I'm going to create the query for, e.g. c AND d,
what's the right way of doing that?  In particular, I
only want one logic operator, but I have to supply one
with each term.  Do I need to create both the 'c' and
'd' terms with AND, or do I put 'OR c' and 'AND d', or
is there something else what I'm missing?

Thanks,

> dave

-derek

-- 
   Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
   Member, MIT Student Information Processing Board  (SIPB)
   URL: http://web.mit.edu/warlord/PP-ASEL-IA N1NWH
   [EMAIL PROTECTED]PGP key available
___
gnucash-devel mailing list
[EMAIL PROTECTED]
http://www.gnumatic.com/cgi-bin/mailman/listinfo/gnucash-devel



Re: Question: How to build complicated queries?

2002-02-03 Thread Dave Peticolas

On Sun, 2002-02-03 at 09:18, Derek Atkins wrote:
> I've been reading the query documentation but I don't
> understand how one is supposed to use the existing APIs
> to build a "complicated" query.
> 
> For example, I want a query to be:
> 
> a && (b || (c && d))
> 
> How would one use the QUERY_AND, QUERY_OR, etc. methods and
> xaccQueryAddTerm() API to build a query of this logic? 
> 
> I guess my question is: what's the API to specify the "order of
> logical operations", or how does one specify parens in a logical
> expression?

To ensure grouping in a complicated expression, it's
best to combine two simpler queries together with
xaccQueryMerge. So you might create the query for
c && d, and a query for 'b', and combine them, and
then combine the resulting query with one for 'a'.

dave




signature.asc
Description: This is a digitally signed message part


Question: How to build complicated queries?

2002-02-03 Thread Derek Atkins

I've been reading the query documentation but I don't
understand how one is supposed to use the existing APIs
to build a "complicated" query.

For example, I want a query to be:

a && (b || (c && d))

How would one use the QUERY_AND, QUERY_OR, etc. methods and
xaccQueryAddTerm() API to build a query of this logic? 

I guess my question is: what's the API to specify the "order of
logical operations", or how does one specify parens in a logical
expression?

Thanks,

-derek
-- 
   Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
   Member, MIT Student Information Processing Board  (SIPB)
   URL: http://web.mit.edu/warlord/PP-ASEL-IA N1NWH
   [EMAIL PROTECTED]PGP key available
___
gnucash-devel mailing list
[EMAIL PROTECTED]
http://www.gnumatic.com/cgi-bin/mailman/listinfo/gnucash-devel