Nope, I can do a single nested fine but than it is a nest in a nest I get 
the problem.

I really just need a way to do a a condition that start with the group 

[code]
    private Condition searchfilter(TreeSet<String> querytags) {

        String[] thetags = querytags.toArray(new String[] {});
        Condition condition = null;
        for (int i = 0; i < thetags.length; i++) {
            String query = thetags[i].trim();
            Integer querynum = null;
            try {
                querynum = Integer.valueOf(query);
            } catch (NumberFormatException e) {

            }
            if (i == 0) {

                condition = 
Ordermain.ORDERMAIN.HIDDENKEY.contains(querynum).and(Ordermain.ORDERMAIN.HIDDENKEY.contains(querynum).or(Ordermain.ORDERMAIN.ORDERTYPE.contains(query)).or(Ordermain.ORDERMAIN.CONTACTNAME.contains(query)).or(Ordermain.ORDERMAIN.ECLIPSEACCOUNTNUMBER.contains(querynum)).or(Ordermain.ORDERMAIN.PHONE.contains(query)).or(Ordermain.ORDERMAIN.COMPANY.contains(query)).or(Ordermain.ORDERMAIN.EMAIL.contains(query)).or(Ordermain.ORDERMAIN.FAX.contains(query)).or(Ordermain.ORDERMAIN.EMPLOYEEID.contains(query)).or(Employees.EMPLOYEES.FIRSTNAME.contains(query)).or(Employees.EMPLOYEES.LASTNAME.contains(query)).or(Employees.EMPLOYEES.EMAIL.contains(query)).or(Ordermain.ORDERMAIN.ORDERNUMBER.contains(query)).or(Ordermain.ORDERMAIN.CUSTOMERPO.contains(query)).or(Ordermain.ORDERMAIN.NEXTACTION.contains(query)).or(Ordermain.ORDERMAIN.SEARCHTAGS.contains(query)).or(Ordermain.ORDERMAIN.ORDERSTATUS.contains(query)));
            } else {
                condition = 
condition.and(Ordermain.ORDERMAIN.HIDDENKEY.contains(querynum).or(Ordermain.ORDERMAIN.ORDERTYPE.contains(query)).or(Ordermain.ORDERMAIN.CONTACTNAME.contains(query)).or(Ordermain.ORDERMAIN.ECLIPSEACCOUNTNUMBER.contains(querynum)).or(Ordermain.ORDERMAIN.PHONE.contains(query)).or(Ordermain.ORDERMAIN.COMPANY.contains(query)).or(Ordermain.ORDERMAIN.EMAIL.contains(query)).or(Ordermain.ORDERMAIN.FAX.contains(query)).or(Ordermain.ORDERMAIN.EMPLOYEEID.contains(query)).or(Employees.EMPLOYEES.FIRSTNAME.contains(query)).or(Employees.EMPLOYEES.LASTNAME.contains(query)).or(Employees.EMPLOYEES.EMAIL.contains(query)).or(Ordermain.ORDERMAIN.ORDERNUMBER.contains(query)).or(Ordermain.ORDERMAIN.CUSTOMERPO.contains(query)).or(Ordermain.ORDERMAIN.NEXTACTION.contains(query)).or(Ordermain.ORDERMAIN.SEARCHTAGS.contains(query)).or(Ordermain.ORDERMAIN.ORDERSTATUS.contains(query)));
            }
        }

        return condition;
    }
[/code]

of you look at my code, I dont want the
[code]Ordermain.ORDERMAIN.HIDDENKEY.contains(querynum).and[/code]

part however I need to put that condition in a group first


I not sure if you get my idea.


my whole gen sql becomes
[code]select `ordermain`.`hiddenkey`, `ordermain`.`ordertype`, 
`ordermain`.`ordernumber`, `ordermain`.`customerpo`, 
`ordermain`.`internalduedatetime`, `ordermain`.`orderstatus`, 
`ordermain`.`company`, `ordermain`.`orderdate`, `ordermain`.`employeeid`, 
`ordermain`.`nextaction`, `ordermain`.`potentialrepeatfrequency`, 
`ordermain`.`potentialinternalcomments`, `ordermain`.`potentialrepeatdate`, 
`ordermain`.`totalcapprice`, `ordermain`.`totaldecorationprice`, 
`ordermain`.`totalprice`, `employees`.`firstname`, `employees`.`lastname` 
from `ordermain` join `employees` on `ordermain`.`employeeid` = 
`employees`.`username` where ((`ordermain`.`orderstatus` = 'Choose One:' or 
`ordermain`.`orderstatus` = 'New Copy' or `ordermain`.`orderstatus` = 'New 
Order' or `ordermain`.`orderstatus` = 'New Quotation' or 
`ordermain`.`orderstatus` = 'Order Wrap-Up Call' or 
`ordermain`.`orderstatus` = 'Partially Shipped' or 
`ordermain`.`orderstatus` = 'Presentation Concept Request' or 
`ordermain`.`orderstatus` = 'Presentation Sample Request' or 
`ordermain`.`orderstatus` = 'Quotation Follow-Up' or 
`ordermain`.`orderstatus` = 'Rush Order' or `ordermain`.`orderstatus` = 
'Rush Order Request' or `ordermain`.`orderstatus` = 'Waiting for Accounting 
Approval' or `ordermain`.`orderstatus` = 'Waiting for Balance' or 
`ordermain`.`orderstatus` = 'Waiting for Creating Artwork' or 
`ordermain`.`orderstatus` = 'Waiting for Creating Film' or 
`ordermain`.`orderstatus` = 'Waiting for Customer Artwork' or 
`ordermain`.`orderstatus` = 'Waiting for Customer Tape' or 
`ordermain`.`orderstatus` = 'Waiting for Deposit' or 
`ordermain`.`orderstatus` = 'Waiting for Digitize' or 
`ordermain`.`orderstatus` = 'Waiting for Heat Press Transfer' or 
`ordermain`.`orderstatus` = 'Waiting for i-Sample' or 
`ordermain`.`orderstatus` = 'Waiting for Logo Color' or 
`ordermain`.`orderstatus` = 'Waiting for New Account Setup' or 
`ordermain`.`orderstatus` = 'Waiting for Overseas Confirmation' or 
`ordermain`.`orderstatus` = 'Waiting for Production Final Approval' or 
`ordermain`.`orderstatus` = 'Waiting for Purchase Order' or 
`ordermain`.`orderstatus` = 'Waiting for Q.C. Report' or 
`ordermain`.`orderstatus` = 'Waiting for Sample' or 
`ordermain`.`orderstatus` = 'Waiting for Sample Approval' or 
`ordermain`.`orderstatus` = 'Waiting for Stock' or 
`ordermain`.`orderstatus` = 'Waiting for Swatch' or 
`ordermain`.`orderstatus` = 'Waiting for Swatch Approval' or 
`ordermain`.`orderstatus` = 'Waiting to Receive Production') and 
`ordermain`.`hiddenkey` like concat('%', 'null', '%') escape '!' and 
(`ordermain`.`hiddenkey` like concat('%', 'null', '%') escape '!' or 
`ordermain`.`ordertype` like concat('%', 'cat', '%') escape '!' or 
`ordermain`.`contactname` like concat('%', 'cat', '%') escape '!' or 
`ordermain`.`eclipseaccountnumber` like concat('%', 'null', '%') escape '!' 
or `ordermain`.`phone` like concat('%', 'cat', '%') escape '!' or 
`ordermain`.`company` like concat('%', 'cat', '%') escape '!' or 
`ordermain`.`email` like concat('%', 'cat', '%') escape '!' or 
`ordermain`.`fax` like concat('%', 'cat', '%') escape '!' or 
`ordermain`.`employeeid` like concat('%', 'cat', '%') escape '!' or 
`employees`.`firstname` like concat('%', 'cat', '%') escape '!' or 
`employees`.`lastname` like concat('%', 'cat', '%') escape '!' or 
`employees`.`email` like concat('%', 'cat', '%') escape '!' or 
`ordermain`.`ordernumber` like concat('%', 'cat', '%') escape '!' or 
`ordermain`.`customerpo` like concat('%', 'cat', '%') escape '!' or 
`ordermain`.`nextaction` like concat('%', 'cat', '%') escape '!' or 
`ordermain`.`searchtags` like concat('%', 'cat', '%') escape '!' or 
`ordermain`.`orderstatus` like concat('%', 'cat', '%') escape '!')) order 
by `ordermain`.`internalduedatetime` asc
[/code]

however i want it to be 

[code]select `ordermain`.`hiddenkey`, `ordermain`.`ordertype`, 
`ordermain`.`ordernumber`, `ordermain`.`customerpo`, 
`ordermain`.`internalduedatetime`, `ordermain`.`orderstatus`, 
`ordermain`.`company`, `ordermain`.`orderdate`, `ordermain`.`employeeid`, 
`ordermain`.`nextaction`, `ordermain`.`potentialrepeatfrequency`, 
`ordermain`.`potentialinternalcomments`, `ordermain`.`potentialrepeatdate`, 
`ordermain`.`totalcapprice`, `ordermain`.`totaldecorationprice`, 
`ordermain`.`totalprice`, `employees`.`firstname`, `employees`.`lastname` 
from `ordermain` join `employees` on `ordermain`.`employeeid` = 
`employees`.`username` where ((`ordermain`.`orderstatus` = 'Choose One:' or 
`ordermain`.`orderstatus` = 'New Copy' or `ordermain`.`orderstatus` = 'New 
Order' or `ordermain`.`orderstatus` = 'New Quotation' or 
`ordermain`.`orderstatus` = 'Order Wrap-Up Call' or 
`ordermain`.`orderstatus` = 'Partially Shipped' or 
`ordermain`.`orderstatus` = 'Presentation Concept Request' or 
`ordermain`.`orderstatus` = 'Presentation Sample Request' or 
`ordermain`.`orderstatus` = 'Quotation Follow-Up' or 
`ordermain`.`orderstatus` = 'Rush Order' or `ordermain`.`orderstatus` = 
'Rush Order Request' or `ordermain`.`orderstatus` = 'Waiting for Accounting 
Approval' or `ordermain`.`orderstatus` = 'Waiting for Balance' or 
`ordermain`.`orderstatus` = 'Waiting for Creating Artwork' or 
`ordermain`.`orderstatus` = 'Waiting for Creating Film' or 
`ordermain`.`orderstatus` = 'Waiting for Customer Artwork' or 
`ordermain`.`orderstatus` = 'Waiting for Customer Tape' or 
`ordermain`.`orderstatus` = 'Waiting for Deposit' or 
`ordermain`.`orderstatus` = 'Waiting for Digitize' or 
`ordermain`.`orderstatus` = 'Waiting for Heat Press Transfer' or 
`ordermain`.`orderstatus` = 'Waiting for i-Sample' or 
`ordermain`.`orderstatus` = 'Waiting for Logo Color' or 
`ordermain`.`orderstatus` = 'Waiting for New Account Setup' or 
`ordermain`.`orderstatus` = 'Waiting for Overseas Confirmation' or 
`ordermain`.`orderstatus` = 'Waiting for Production Final Approval' or 
`ordermain`.`orderstatus` = 'Waiting for Purchase Order' or 
`ordermain`.`orderstatus` = 'Waiting for Q.C. Report' or 
`ordermain`.`orderstatus` = 'Waiting for Sample' or 
`ordermain`.`orderstatus` = 'Waiting for Sample Approval' or 
`ordermain`.`orderstatus` = 'Waiting for Stock' or 
`ordermain`.`orderstatus` = 'Waiting for Swatch' or 
`ordermain`.`orderstatus` = 'Waiting for Swatch Approval' or 
`ordermain`.`orderstatus` = 'Waiting to Receive Production') and 
(`ordermain`.`hiddenkey` like concat('%', 'null', '%') escape '!' or 
`ordermain`.`ordertype` like concat('%', 'cat', '%') escape '!' or 
`ordermain`.`contactname` like concat('%', 'cat', '%') escape '!' or 
`ordermain`.`eclipseaccountnumber` like concat('%', 'null', '%') escape '!' 
or `ordermain`.`phone` like concat('%', 'cat', '%') escape '!' or 
`ordermain`.`company` like concat('%', 'cat', '%') escape '!' or 
`ordermain`.`email` like concat('%', 'cat', '%') escape '!' or 
`ordermain`.`fax` like concat('%', 'cat', '%') escape '!' or 
`ordermain`.`employeeid` like concat('%', 'cat', '%') escape '!' or 
`employees`.`firstname` like concat('%', 'cat', '%') escape '!' or 
`employees`.`lastname` like concat('%', 'cat', '%') escape '!' or 
`employees`.`email` like concat('%', 'cat', '%') escape '!' or 
`ordermain`.`ordernumber` like concat('%', 'cat', '%') escape '!' or 
`ordermain`.`customerpo` like concat('%', 'cat', '%') escape '!' or 
`ordermain`.`nextaction` like concat('%', 'cat', '%') escape '!' or 
`ordermain`.`searchtags` like concat('%', 'cat', '%') escape '!' or 
`ordermain`.`orderstatus` like concat('%', 'cat', '%') escape '!')) order 
by `ordermain`.`internalduedatetime` asc
[/code]

On Friday, June 29, 2012 8:06:19 AM UTC-7, Lukas Eder wrote:
>
> > main thing is i already used the where and i need to add a condition 
> case in 
> > another condition i need  something to start the ( ) 
>
> I'm not exactly sure where you're running into trouble. Does the 
> answer I gave you on Stack Overflow help at all? 
> http://stackoverflow.com/questions/11247797/jooq-nested-condition/11262608 
>
> When you write 
> .where(...) 
>
> The argument to pass to the where() method is a Condition. Conditions 
> can be arbitrarily nested using Condition.and() and Condition.or() as 
> well as other useful methods documented in the Javadoc and in the 
> manual. 
>
> Did that help? 
>

Reply via email to