+ Start a Discussion

Adding values from merge fields directly in pageblock table or repeater


Im querying list of records from an object with fields Name,value1__c,value2__c.
I m not using any wrapper class to build this list.
and displayed all the data in pageblock table.
Here i need to add one more column to the existing pageblock table there i want to add the value1__c and value2__c and want to show in a new field.
When i am adding this with a merge field these two values are going to concate instead of addition like below
10 20 10+20
But i want
10 20 30
Any idea!

What does your markup look like at the moment?



1. You need to create a list on the VF.

2. get all of fields from object, put them to this list.

3. create a pageblock, put a dynamic table to it.

4. when a user select a value from list. refresh pageblock.


Hope this helps.






<apex:page standardController="Account" recordSetVar="accounts" tabstyle="Account">
    <apex:form >
        <apex:pageBlock >
       <apex:pageBlockTable value="{!accounts}" var="acc">
            <apex:column > {!acc.id} </apex:column>
            <apex:column > {!acc.Account_Total_Amount__c} </apex:column>
            <apex:column > {!acc.No_Of_Contacts__c}</apex:column>
            <apex:column >{!acc.NumberofLocations__c}</apex:column>
            <apex:column >
            {!acc.No_Of_Contacts__c+ acc.NumberofLocations__c}

 Basically it will be like {!apinameofield1 + apinameoffield2}