Visualforce Page:
<apex:page showHeader="false" sidebar="False" controller="textInputsCon">
<apex:form >
Input Text1 <apex:inputText value="{!inputText1}"/><br/>
<apex:selectList id="inputText3" value="{!inputText3}" size="1">
<apex:selectOption itemValue="Quote_number_new__c" itemLabel="Quote Number"/>
<apex:selectOption itemValue="From1__c" itemLabel="from"/>
<apex:selectOption itemValue="Null" itemLabel="None"/>
</apex:selectList> <br/>
Input Text2 <apex:inputText value="{!inputText2}"/><br/>
<apex:selectList id="inputText4" value="{!inputText4}" size="1">
<apex:selectOption itemValue="Quote_number_new__c" itemLabel="Quote Number"/>
<apex:selectOption itemValue="From1__c" itemLabel="from"/>
<apex:selectOption itemValue="From1__c" itemLabel="None"/>
</apex:selectList>
<apex:selectList id="operator" value="{!operator}" size="1"><br/>
<apex:selectOption itemValue="=" itemLabel="Equal"/>
<apex:selectOption itemValue="!=" itemLabel="Not equal to"/>
<apex:selectOption itemValue="<=" itemLabel="Less than"/>
</apex:selectList>
<apex:commandButton value="list" action="{!showlist}"/>
<apex:pageBlock >
<apex:pageBlockTable value="{!quo}" var="q">
<apex:column value="{!q.Quote_Number_New__c}"/>
<apex:column value="{!q.From1__c}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller:
public with sharing class textInputsCon {
public String inputText1{get;set;} // input text1 value from vf
public String inputText2{get;set;} // input text2 value from vf
public String inputText3{get;set;} // input text1 value from vf
public String inputText4{get;set;}
Public string operator{get;set;}
public list<Quote__c> quo{get;set;} //this is will hold data to be displayed on page
// string query1='select id from Quote_line_item__c ';
string query='select id,from1__c,Quote_number_new__c,(select id from Quote_line_item__r) from quote__c ';
public void showlist(){ //do not return anything
if(inputText1<>''){
query += 'WHERE ' + inputText3 + ' ' + operator + ' : inputText1' ; }
if(inputText2<>''){
query +=' and '+ inputText4 + ' ' + operator + ' : inputText2'; }
quo = database.query(query);
}
}
Error:
System.QueryException: Didn't understand relationship 'Quote_line_item_r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '_r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.
string query='select id,from1__c,Quote_number_new__c,(select id from Quote_line_item__r) from quote__c ';
Quote_Line_Items
? – bigassforce Feb 6 '14 at 6:10