Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Adding a column of time totals

Avatar

Former Community Member

Hello,

I have a column of  time totals in a table that I'd like to add.

For example:

11:33

25:56

67:44

and so on. The method is to split/parse the string, add the rightmost 2 digits of each total to get the total minutes, and the leftmost 2 digits to get the total hours. I haven't included anything to process the minutes total further (i.e. mins / 60 etc) as I can't even get the basic calculation working first.

The code I'm trying is:

//check if at least one row exists in this section of the table

if  (_Row1.count > 0) then                                                         

     //add rightmost two digits to get minutes total

     mins = Sum (Right (Row1[*].total[*], 2))                                

      //add leftmost two digits to get hours total

     hrs = Sum (Left (Row1[*].total[*], (Len (Row1[*].total[*] - 3))))  

endif

I'd appreciate someone telling me why this is not working. The table is dynamic and rows are added as needed. 
Thanks.

Message was edited by: HarryOhm

2 Replies

Avatar

Former Community Member

Please disregard. I got it working finally.

Avatar

Level 2

What was the final code that worked?

thanks,