Saturday, May 13, 2017

Crystal Reports Cross tab date processing

The task here was to create a report that has the number of orders created by hour. The time stamp for orders is on the transaction table from trans code 001 = order created and the time stamp. The system has an Orders table, header and detail and the transaction table is a little sketchy, but it has orders and transaction codes. Every order, has work done on it, from taking a phone call about a product, or via a web chat, to the sales process, then the work on the order, the planning, engraving, extras, the picking, packing etc. This allows senior management to monitor the flow at any given time. So, basically we want to see the number of orders for each day of the week by hour.2 week span. I used Crystal Reports Cross tab function. I used functions to get the count. if {@date} IN [Minimum(lastfullweek)+1 TO Maximum(lastfullweek)+1] OR {@date} IN [Maximum(lastfullweek)+2 TO Maximum(lastfullweek)+8] then 1 else 0; Set the week to start Monday: (datepart('w',{@date},crMonday)) Time set and edit: Time(Picture(Right('0000000000'&totext({OETRA99.OTTRT},'#'),6),'xx:xx:xx')) Set date for count: stringvar dd := picture(totext({OETRA99.OTTRND},'#'),'xxxx/xx/xx'); if isdate(dd) then date(dd) and the result is showing orders entered by hour: Orders Created by Hour Monday Tuesday Wednesday Last Week Current Week Last Week Current Week 12:00AM 28 33 22 26 15 22 5:00AM 39 48 31 43 52 56 6:00AM 7 6 6 9 7 7 7:00AM 12 18 16 24 11 19

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home