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
Hitesh chaudhariHitesh chaudhari 

How to print two maps simultaneously

In my current scenario I am having two maps and I want them to print in same table.

Map<Custom Object, String 1> map1 ;
Map< String2, Custom Object, > map2 ;

In the above case String 2 is an calculated String not a custom Field
Table output will be like this

 
Column 1                             || Column 2 || Column 3
CustomObejct_ID                 || String1     ||String 2
Best Answer chosen by Hitesh chaudhari
mritzimritzi
You can create a wrapper class in Apex Controller to get desired outcome
 
//this is sample code, make change wherever required to suit your requirement
public  with sharing class YourApexController{
	//other variables
	public List<NewWrapper> wrapperList{get;set;}
	//populate this list of wrapper in relevant method
	
	//other methods
	
	public class NewWrapper{
		public Custom_Object__c customObject{get;set;}
		public String str1{get;set;}
		public String str2{get;set;}
		public NewWrapper(Custom_Object__c customObjectm, String str1, String str2){
			this.customObject = customObject;
			this.str1 = str1;
			this.str2 = str2;
		}
	}
}
You can then reference it like any other list in VF pageblockTable
<!-- make changes wherever applicable -->
<apex:pageBlockTable value="{!wrapperList}" var="item">
	<apex:column headerValue="Object Id" value="{!item.customObject.Id}"/>
	<apex:column headerValue="String1" value="{!item.str1}"/>
	<apex:column headerValue="String2" value="{!item.str2}"/>
</apex:pageBlockTable>

Please mark this as BEST ANSWER, if this helps solve your problem.