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
Sowmya YakkalaSowmya Yakkala 

how to get the data in new line in apex salesforce lightning

Hi i want to display the data in newline and i tried with <br/> and </n> but it was not working. And my code is

for( Opportunity oppLst : [Select Id,Name,Cart_Grand_Total__c, (Select Product_SKU__c,DeliveryDate__c from  Shopping_cart_line_items__r where DeliveryDate__c >Today )
                                 from Opportunity where AccountId =:accountId  and  StageName='Closed Won' ])
             for(Shopping_cart_line_item__c scL : oppLst.Shopping_cart_line_items__r){
              DateTime DeliveryDate = scL.DeliveryDate__c;
              upcmngDeleviries += DeliveryDate.format('MM/dd/yyyy')+'\n';
           upcmngDeleviries +='$'+oppLst.Cart_Grand_Total__c +'\n';
       return upcmngDeleviries ;

Actual Output: 01/23/2020 $660.29 01/22/2020 01/22/2020 $1373.84

Expected Output : 01/23/2020 $660.29
                              01/22/2020 01/22/2020 $1373.84
Best Answer chosen by Sowmya Yakkala
Maulik D ShahMaulik D Shah
Hello Sowmya,

Include a line break within a String with the use of '< br/>' and displaying it on the component as follows
<aura:unescapedHtml value="{!v.yourString}" />

I hope this helps you.