|
|||||||||
|
Crystal Reports Tools: Improve Performance While Saving Time and Money |
|
Crystal Reports: Displaying Minutes as Hours and MinutesOur client was using a field to store a value in minutes. The report summarized these, and he wanted to see the totals displayed as Hours and minutes. In this situation, it is best to maintain the values in the lowest level units (in this case minutes) and use the display string to property to display the value in the higher level units. The Display String conditional format on the field and its total was
If you don’t want to see the hours if it is zero then replace the last line with
Tip: By using the "CurrentFieldValue" function in the formula, it was easy to copy and paste the formula into the other fields on the report that also had a value in minutes.
You can also display days of the week. What if, for example, you want to know how many Fridays (pay day) there are between two dates? Crystal Reports includes a function that can calculate how many days of the week between two dates. It can also count how many Thursdays between the two dates (or you can select any day of the week). Use a formula of:
This article is copyrighted by Crystalkeen, Mindconnection, and Chelsea Technologies Ltd. It may be freely copied and distributed as long as the original copyright is displayed and no modifications are made to this material. Extracts are permitted. The names Crystal Reports and Seagate Info are trademarks owned by Business Objects. |
|
A related topic is date formatting. Suppose you are communicating with someone who does business internationally and ask for an item to be delivered "on 03/09/2006." When can you expect that item to arrive? You may be thinking you are going to get it on March 9th. But, the other person reads this as 03 September. What can you do to avoid problems? A commonly accepted solution is to use MMM to indicate the month. Three upper case letters in a date format means you are using a three-letter designation for the month. For example, 03SEP2006. There's no confusion as to what month you can expect delivery. This method of mixing alpha and numeric solves a communication problem quite handily. But what about inside a database or spreadsheet, where you need to do calculations with dates? It's a bit hard to subtract FEB from NOV, now, isn't it? So how do you guarantee you are going to get the month and the day in the correct order? In software--especially in databases, file systems, and spreadsheets, another format is fairly standard and it solves that problem. You'll also see this format in inventory systems and many other tabular style applications. That format is YYYY-MM-DD. A variation is YYYYMMDD. So, it will look like this: 20060903. The largest unit (years) are on the left, and the smallest units (days) are on the right. Why not do it the other way? Well, you could. But what if you wanted to sort by date? Or perform a calculation that involved different months or years? To avoid confusion:
To avoid related confusion:
If you are using the 12-hour clock, you should consider going to a 24-hour time standard. This also avoids confusion, especially if you run a multishift or 24-hour operation.
|