Custom - Detailed Sales Report by Hour - Problem with leading zero

I downloaded this report from customer source and put it on my POS. Running the report seems to take forever (compared to any other Detailed Sales Report). The main flaw of the report is that any sales done until 9:59 shows up at the end of the report as the report obviously does not use a leading zero, thus, when the report is sorted 9:00 is higher then 10:00 because of the missing leading zero.

I googled for anything related to "cast(DataPart" and found lots of hits. I have tried it with RIGHT('00 + cast...., changing the receiving variables to char or char(2), but the result is always loosing the leading zero.

Anybody knows how I can fix that?

Thanks in advance.

Reply to
Gerd
Loading thread data ...

hi Gerd, use the below to accomplish the result: replicate('0',2-len(cast(DatePart(Hh,[Transaction].Time) as char(2))))+cast(DatePart(Hh,[Transaction].Time) as char(2))

Rate > I downloaded this report from customer source and put it on my POS. Running

Reply to
Akber Alwani

hi Gerd, use the below to accomplish the result: replicate('0',2-len(cast(DatePart(Hh,[Transaction].Time) as char(2))))+rtrim(cast(DatePart(Hh,[Transaction].Time) as char(2)))+':00'

Rate > I downloaded this report from customer source and put it on my POS. Running

Reply to
Akber Alwani

BeanSmart website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.