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
Rst123Rst123 

Help!! Format result in column

Hi,

I'm getting the result of total price of 2 opportunityline item in one row 25225.17 37837.75  format

where as i want the result in different row i.e total price of opportunityline item should come in front   of respective lineitem                                     

25225.17

37837.75

 

My code :-

public Class cOpportunity{        

public Product2 opppr1 {get;set;}        

public Opportunity opp {get;set;}       

  public Account acc1 {get;set;}     

    public Boolean selected{get;set;}       

  public String convertPrice {get;set;}       

  //public Decimal convertPrice {get;set;}     

     List<OpportunityLineItem> oppLineLst;     

    cOpportunity(Opportunity o){          

   convertPrice = '';             opp=o;          

   selected=false;           

          

  For(OpportunityLineItem ol :o.OpportunityLineItems){             

Double conversionRate = [SELECT conversionrate,IsoCode FROM currencytype WHERE isocode =:ol.CurrencyIsoCode LIMIT 1].conversionRate;     

                     //  if(!convertPrice.contains(String.ValueOf(ol.TotalPrice * conversionRate)))          

     if(ol.CurrencyIsoCode != 'USD')           

       convertPrice +=   '\n\r'+ (ol.TotalPrice * (1/conversionRate)).setscale(2)+'\n\r';         

       else               

  convertPrice +=   '\n\r'+ (ol.TotalPrice).setscale(2) +'\n\r';         

    }             

        }

    }

Bhawani SharmaBhawani Sharma
String str = '\r\n' + 'A' + '\r\n' + 'B';
System.debug(str);
Rst123Rst123

@Bhawani Sharma
Thanks for reply!!

I have written a VF page with 3 columns :- Opportunity,Opportunitylineitem,Total price
Now there can be no. of opportunitylineitem against opportunity so total price of each opportunity lineitem should reflect against to its respective opportunity lineitem .
In that case current result is coming 25225.17 37837.75 756432.098 9237234.008......... i.e in single line
where as it should come in diff. lines

25225.17

37837.75

756432.09

9237234.08

.

.

.

.
How String str = '\r\n' + 'A' + '\r\n' + 'B'; will work in multiple opportunityline item and total price

Bhawani SharmaBhawani Sharma
Why are you not using the variable directly on the page Like :
<apex:pageBlocTable value="{!oLIs}" var="item">
<apex:column value="{!item.OpportunityId}"/>
<apex:column value="{!item.Name}"/>
<apex:column value="{!item.TotalPrice}"/>
</apex:repeat>
Rst123Rst123

 @Bhawani Sharma:-

Thyanks for Help!!

 

But not able to figureout what i'm doing wrong here :-

My VF Code

 

<apex:outputPanel rendered="true">                

  <apex:pageBlockTable value="{!Opportunities}" var="varOpp" id="xyz">                  

   <apex:column width="30px" headerValue="Opportunity Name">                 

   <apex:outputLink value="/{!varOpp.opp.Id}"> {!varOpp.opp.Name}

</apex:outputLink>    

                </apex:column>         

                               <apex:column headerValue=" Account Name" value="{!varOpp.opp.AccountId}"/>                     <apex:column headerValue=" Region" value="{!varOpp.opp.Account.Region__c}"/>                   

  <apex:column headerValue=" Zone" value="{!varOpp.opp.Account.Zone__c}"/>               

      <apex:column headerValue="Country" value="{!varOpp.opp.Account.Country_Name_2__c}"/>                                                    <apex:column headerValue="Product Name">                            

  <apex:repeat value="{!varOpp.opp.OpportunityLineItems}" var="PrdLst" >

                                    <apex:outputText value="{!PrdLst.Product_Name__c}"/><br/>                                                           </apex:repeat>         

                                        </apex:column>                 

                       <apex:column headerValue="Total Price">          

      <apex:repeat value="{!varOpp.opp.OpportunityLineItems}" var="PrdLst" rendered="{!if(varOpp.opp.OpportunityLineItems.size>0 , true, false)}" >                        

    <apex:outputField value="{!PrdLst.TotalPrice}" style="font-size"/> <br/>                 

              <apex:param value="{!varOpp.convertPrice}"/>                     

                      </apex:repeat>                                        

         </apex:column>               

        <apex:column headerValue="Total Price(USD)">                          

                                  <apex:repeat value="{!varOpp.convertPrice}" ><br/>         

       <apex:outputText value="{!varOpp.convertPrice}" rendered="{!if(varOpp.opp.OpportunityLineItems.size >0 , true, false)}" style="font-size" > <br/>            

        <apex:param value="{!varOpp.convertPrice}"/><br/>         

                      </apex:outputText>      

                 </apex:repeat>                                             

    </apex:column>

Bhawani SharmaBhawani Sharma
<apex:repeat value="{!varOpp.convertPrice}" >

You are missing "var" attribute.
Rst123Rst123
hmm...i have put <apex:repeat value="{!varOpp.convertPrice}" var="PrdLst"><br/>

but still dint hep it out :(