+ Start a Discussion
Emily Walton 16Emily Walton 16 

Apex Class Updating Text Box, but Values Not Merging in DDP

We have an Apex Class that is combing values from records in a related list (TimeCard Caluculator) on a custom object (Daily Time Card) and putting those values into a large text box in on the custom object (Field Name: Description of the Day's Events). This works fine when you are looking at the record. However, when we try and tag that text box field in an Excel DDP (drawloop), it only brings in the first line and sometimes it doesn't bring that in correctly. Is this something that needs to be changed in the Apex Class? Or something I can fix in Drawloop? 

The part of the code that I believe is doing this:      
 
            String dailyWorkSteps = '';
            for(TimeCard_Calculator__c tc :tCalList){ dailyWorkSteps += (tc.Step_Full_Text__c!=null?tc.Step_Full_Text__c :' ') + (tc.Other_Description__c != null && tc.Other_Description__c != ''?  (': ' + tc.Other_Description__c + ','):' ') + (tc.Step_Full_Text2__c!= null?(' ' + tc.Step_Full_Text2__c):' ') + (tc.Delay_Description__c != null && tc.Delay_Description__c != ''? ('. ' + tc.Delay_Description__c ):'') + '\n'; }            
            dtrObject.description_days_events__c = dailyWorkSteps ;
            dtrObject.TIMECARD_SCALE_STYLE__c= TIMECARD_SCALE_STYLE;
            dtrObject.TIMECARD_STARTTIME__c= TIMECARD_STARTTIME;
            update dtrObject; 
        }catch(Exception e){
           ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR, 'There is an error occurred due to : ' + e.getMessage()));
           errorFlag = true; 
        }        
        return errorFlag;
    }