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
Ram chowdaryRam chowdary 

How to display similar records from two fields in vf page

In an  Account object there are two fields called Address1 and Address2 and I have 100,000 records, out of 70,000 record values are equal in field1 and field2. Now Display those 70,000 records on visualforce page.

How to achieve this?
Gyanender SinghGyanender Singh
Hi Ram,

if  you want to take only those record where value in Address1 and Address2 are same , so try the code of vf page and apex class as follow and this is the demo code:
 
<apex:page controller="Accountcls">
    <apex:form>
        <table cellpadding="0" cellspacing="0" border="1">
            <apex:repeat var="record" value="{!recordList2}">
                <tr>
                    <td>{!record.Address_1__c}</td>
                    <td>{!record.Address_2__c}</td>
                </tr>
            </apex:repeat> 
        </table>
    </apex:form>
</apex:page>

public class Accountcls {
    public list<Account> recordList{get;set;}
    public list<Account> recordList2{get;set;}
    public Accountcls(){
        
        recordList = new list<Account>();
        recordList2 = new list<Account>();
        list<string> fieldstring = new list<string>();
        recordList = [select id,Address_1__c,Address_2__c from Account ];
        for(Account__c acc : recordList){
            if(acc.Address_1__c == acc.Address_2__c){
                fieldstring.add(vndr.Address_1__c);
            }
        }
        recordList2 = [select id,Address_1__c,Address_2__c from Account where Address_1__c in : fieldstring];
    }
}

Thanks
Gyani
Ram chowdaryRam chowdary
Thanks Gyani :)
Gyanender SinghGyanender Singh
If this is the solution of your problem then don't forget to choose as the Best Answer.
Ram chowdaryRam chowdary
Hi I am struck with this query, the maximum number of records we ca display in vf pages are 10000( by using list controller and enabling read only option) but how can we display 70,000 records?