function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ttlttl 

Using soql Based on Lookup field Value selection

Hi Guys,

 

I Created one custom Object which have one Lookup Account field , Based on this Lookup field Value,i want to fetch all records of Custom Object and put it in tabular format using data table.

 

Guys I created two visualforce pages and one controller.First visualforce page is dispalying only the Account Lookup field ,when User click on Next  then the soql query should be executed and save in a list ,Using this list I want to display the value of all field in second Visualforce page using data table.

 

Guys My controller structure as

 

public class Accountscore_card {

public List<Account_Score__c> accList1= new List<Account_Score__c>();

public Account_Score__c acc1{get;set;}

public Accountscore_card (ApexPages.StandardController controller){

acclist1= [select f1,f2,f3...from Account_Score__c where f1=:acc1.f1];

}

public List<Account_Score__c> getAcclist1(){

if(acc1 == null) acc1 = new Account_Score__c();

return acclist1;

}

public PageReference method1(){

return page.recordpage1;

}

public Account_Score__c getAcc1(){

 return acc1;

}

 }

 

First Visual Force Page as

<apex:page standardController="Account_Card__c" extensions="Accountscore_card">

<apex:form >

<apex:pageBlock title="Account Selection">

<apex:inputField Value={!account1.Account__c}/>

<apex:commandButton title="selected account" action="{!method1}" value="Next"/>

</apex:pageBlock>

</apex:form>

</apex:page>

 

second Visual force page like

 

<apex:page standardController="Account_Score__c"  extensions="Accountscore_card">

  <apex:form >

   <apex:pageBlock title="Account's spend on Telecom (Rs. Crore)">

   <apex:pageBlockSection title="Details" Id="NewCard">

  

    <apex:dataTable value="{!acclist1}" var="test" border="1" style="height:20;float: left;" id="stable">

     <apex:column headerValue="Account Name" width="5px">

              <apex:outputField value="{!test.field1}" style="align: center" />

     </apex:column>

--------------------

--------------------

---------------------

  </apex:dataTable></apex:pageBlocksection> 

</apex:pageBlock>

</apex:form>

</apex:page>

 

Guys please help.....

 

Thanks

Prince

 

logpramzlogpramz

were you able to do this? I'm stuck with the same problem. it would be great if you can post how you were able to do it.