deddleston
Programmer
Ok i have this code:
<%
DAOImplementer dao = new DAOImplementer();
String query = "SELECT ";
System.out.println( "component_name: "+ request.getParameter("component_name" );
System.out.println( "chbxTN: "+ request.getParameter("chbxTN" );
System.out.println( "chbxTD: "+ request.getParameter("chbxTD" );
System.out.println( "chbxTDV: "+ request.getParameter("chbxTDV" );
//add the fields you are selecting to the query
//Table section
if ((request.getParameter("chbxTN" != null) && (request.getParameter("chbxTD" == null)
&& (request.getParameter("chbxTDV" == null)){
query = query + (request.getParameter("chbxTN");
}
if ((request.getParameter("chbxTN" == null) && (request.getParameter("chbxTD" != null)
&& (request.getParameter("chbxTDV" == null)){
query = query +(request.getParameter("chbxTD");
}
if ((request.getParameter("chbxTN" == null) && (request.getParameter("chbxTD" == null)
&& (request.getParameter("chbxTDV" != null)){
query = query +(request.getParameter("chbxTDV");
}
if ((request.getParameter("chbxTN" != null) && (request.getParameter("chbxTD" != null)
&& (request.getParameter("chbxTDV" == null)){
query = query +(request.getParameter("chbxTN") +", " +(request.getParameter("chbxTD");
}
if ((request.getParameter("chbxTN" == null) && (request.getParameter("chbxTD" != null)
&& (request.getParameter("chbxTDV" != null)){
query = query +(request.getParameter("chbxTD") +", " +(request.getParameter("chbxTDV");
}
if ((request.getParameter("chbxTN" != null) && (request.getParameter("chbxTD" == null)
&& (request.getParameter("chbxTDV" != null)){
query = query +(request.getParameter("chbxTN") +", " +(request.getParameter("chbxTDV");
}
if ((request.getParameter("chbxTN" != null) && (request.getParameter("chbxTD" != null)
&& (request.getParameter("chbxTDV" != null)){
query = query +(request.getParameter("chbxTN") +", " +(request.getParameter("chbxTD")
+", " +(request.getParameter("chbxTDV");
}
System.out.println( "chbxCN: "+ request.getParameter("chbxCN" );
System.out.println( "chbxCD: "+ request.getParameter("chbxCD" );
System.out.println( "chbxCDV: "+ request.getParameter("chbxCDV" );
//Column section
if ((request.getParameter("chbxCN" != null) && (request.getParameter("chbxCD" == null)
&& (request.getParameter("chbxCDV" == null)){
query = query + (request.getParameter("chbxCN");
}
if ((request.getParameter("chbxCN" == null) && (request.getParameter("chbxCD" != null)
&& (request.getParameter("chbxCDV" == null)){
query = query +(request.getParameter("chbxCD");
}
if ((request.getParameter("chbxCN" == null) && (request.getParameter("chbxCD" == null)
&& (request.getParameter("chbxCDV" != null)){
query = query +(request.getParameter("chbxCDV");
}
if ((request.getParameter("chbxCN" != null) && (request.getParameter("chbxCD" != null)
&& (request.getParameter("chbxCDV" == null)){
query = query +(request.getParameter("chbxCN") +", " +(request.getParameter("chbxCD");
}
if ((request.getParameter("chbxCN" == null) && (request.getParameter("chbxCD" != null)
&& (request.getParameter("chbxCDV" != null)){
query = query +(request.getParameter("chbxCD") +", " +(request.getParameter("chbxCDV");
}
if ((request.getParameter("chbxCN" != null) && (request.getParameter("chbxCD" == null)
&& (request.getParameter("chbxCDV" != null)){
query = query +(request.getParameter("chbxCN") +", " +(request.getParameter("chbxCDV");
}
if ((request.getParameter("chbxCN" != null) && (request.getParameter("chbxCD" != null)
&& (request.getParameter("chbxCDV" != null)){
query = query +(request.getParameter("chbxCN") +", " +(request.getParameter("chbxCD")
+", " +(request.getParameter("chbxCDV");
}
%>
You should see there are 2 sections; table and column, i want to evaluate the 2 but depending on the condition do seperate things, so if:
if ((request.getParameter("chbxTN" != null) | (request.getParameter("chbxTD" != null) | (request.getParameter("chbxTDV" != null)
i want to do this
//add FROM (for table selection)
if ((request.getParameter("component_name" == null) && (request.getParameter("instanceName" == null)){
query = query + " FROM component_table";
}
if ((request.getParameter("component_name" != null) && (request.getParameter("instanceName" == null)){
query = query + " FROM component_table, solution_component";
}
if ((request.getParameter("component_name" != null) && (request.getParameter("instanceName" != null)){
query = query + " FROM component_table";
}
if it;s:
if ((request.getParameter("chbxCN" != null) | (request.getParameter("chbxCD" != null) | (request.getParameter("chbxCDV" != null)
i want to do:
//add FROM (for table selection)
if ((request.getParameter("component_name" == null) && (request.getParameter("instanceName" == null)){
query = query + " FROM data_element";
}
if ((request.getParameter("component_name" != null) && (request.getParameter("instanceName" == null)){
query = query + " FROM data_element, solution_component";
}
if ((request.getParameter("component_name" != null) && (request.getParameter("instanceName" != null)){
query = query + " FROM data_element";
}
i'm stuck, any help is greatly apprecitated M$ arn't the only option!
<%
DAOImplementer dao = new DAOImplementer();
String query = "SELECT ";
System.out.println( "component_name: "+ request.getParameter("component_name" );
System.out.println( "chbxTN: "+ request.getParameter("chbxTN" );
System.out.println( "chbxTD: "+ request.getParameter("chbxTD" );
System.out.println( "chbxTDV: "+ request.getParameter("chbxTDV" );
//add the fields you are selecting to the query
//Table section
if ((request.getParameter("chbxTN" != null) && (request.getParameter("chbxTD" == null)
&& (request.getParameter("chbxTDV" == null)){
query = query + (request.getParameter("chbxTN");
}
if ((request.getParameter("chbxTN" == null) && (request.getParameter("chbxTD" != null)
&& (request.getParameter("chbxTDV" == null)){
query = query +(request.getParameter("chbxTD");
}
if ((request.getParameter("chbxTN" == null) && (request.getParameter("chbxTD" == null)
&& (request.getParameter("chbxTDV" != null)){
query = query +(request.getParameter("chbxTDV");
}
if ((request.getParameter("chbxTN" != null) && (request.getParameter("chbxTD" != null)
&& (request.getParameter("chbxTDV" == null)){
query = query +(request.getParameter("chbxTN") +", " +(request.getParameter("chbxTD");
}
if ((request.getParameter("chbxTN" == null) && (request.getParameter("chbxTD" != null)
&& (request.getParameter("chbxTDV" != null)){
query = query +(request.getParameter("chbxTD") +", " +(request.getParameter("chbxTDV");
}
if ((request.getParameter("chbxTN" != null) && (request.getParameter("chbxTD" == null)
&& (request.getParameter("chbxTDV" != null)){
query = query +(request.getParameter("chbxTN") +", " +(request.getParameter("chbxTDV");
}
if ((request.getParameter("chbxTN" != null) && (request.getParameter("chbxTD" != null)
&& (request.getParameter("chbxTDV" != null)){
query = query +(request.getParameter("chbxTN") +", " +(request.getParameter("chbxTD")
+", " +(request.getParameter("chbxTDV");
}
System.out.println( "chbxCN: "+ request.getParameter("chbxCN" );
System.out.println( "chbxCD: "+ request.getParameter("chbxCD" );
System.out.println( "chbxCDV: "+ request.getParameter("chbxCDV" );
//Column section
if ((request.getParameter("chbxCN" != null) && (request.getParameter("chbxCD" == null)
&& (request.getParameter("chbxCDV" == null)){
query = query + (request.getParameter("chbxCN");
}
if ((request.getParameter("chbxCN" == null) && (request.getParameter("chbxCD" != null)
&& (request.getParameter("chbxCDV" == null)){
query = query +(request.getParameter("chbxCD");
}
if ((request.getParameter("chbxCN" == null) && (request.getParameter("chbxCD" == null)
&& (request.getParameter("chbxCDV" != null)){
query = query +(request.getParameter("chbxCDV");
}
if ((request.getParameter("chbxCN" != null) && (request.getParameter("chbxCD" != null)
&& (request.getParameter("chbxCDV" == null)){
query = query +(request.getParameter("chbxCN") +", " +(request.getParameter("chbxCD");
}
if ((request.getParameter("chbxCN" == null) && (request.getParameter("chbxCD" != null)
&& (request.getParameter("chbxCDV" != null)){
query = query +(request.getParameter("chbxCD") +", " +(request.getParameter("chbxCDV");
}
if ((request.getParameter("chbxCN" != null) && (request.getParameter("chbxCD" == null)
&& (request.getParameter("chbxCDV" != null)){
query = query +(request.getParameter("chbxCN") +", " +(request.getParameter("chbxCDV");
}
if ((request.getParameter("chbxCN" != null) && (request.getParameter("chbxCD" != null)
&& (request.getParameter("chbxCDV" != null)){
query = query +(request.getParameter("chbxCN") +", " +(request.getParameter("chbxCD")
+", " +(request.getParameter("chbxCDV");
}
%>
You should see there are 2 sections; table and column, i want to evaluate the 2 but depending on the condition do seperate things, so if:
if ((request.getParameter("chbxTN" != null) | (request.getParameter("chbxTD" != null) | (request.getParameter("chbxTDV" != null)
i want to do this
//add FROM (for table selection)
if ((request.getParameter("component_name" == null) && (request.getParameter("instanceName" == null)){
query = query + " FROM component_table";
}
if ((request.getParameter("component_name" != null) && (request.getParameter("instanceName" == null)){
query = query + " FROM component_table, solution_component";
}
if ((request.getParameter("component_name" != null) && (request.getParameter("instanceName" != null)){
query = query + " FROM component_table";
}
if it;s:
if ((request.getParameter("chbxCN" != null) | (request.getParameter("chbxCD" != null) | (request.getParameter("chbxCDV" != null)
i want to do:
//add FROM (for table selection)
if ((request.getParameter("component_name" == null) && (request.getParameter("instanceName" == null)){
query = query + " FROM data_element";
}
if ((request.getParameter("component_name" != null) && (request.getParameter("instanceName" == null)){
query = query + " FROM data_element, solution_component";
}
if ((request.getParameter("component_name" != null) && (request.getParameter("instanceName" != null)){
query = query + " FROM data_element";
}
i'm stuck, any help is greatly apprecitated M$ arn't the only option!