Archive

Archive for August, 2011

Remove trailing character in Crystal Reports Formula

This is a relatively straight forward formula to help you remove the last character of a string.

It may be that you wish to remove a period from the end of a field name or an inverted comma. Here we will call our field {DBField1}

 

left({DBField1},len({DBField1})-1)

All we are doing here is using the left function to display all the characters to the left, excluding the last chacter, (which is determineted by the “Len” function)

NOT IN Syntax – Excluding records in Crystal

So you need to exclude a few records from your reports in Crystal.
Perhaps that stray erroneous record in the DB which has never been fixed, or a list or exclude customers for a certain country/state.

If you have a list of values and you want to exclude them, then NOT IN will help you do to this. This can be used for both record selection, or on the suppression criteria for groupings.

So lets say you want to exclude customer ID’s 1512, 1563 and 1765 from appearing in your report.

Simply add in your selection criteria;

NOT({CustomerID} IN [“1512″,”1563″,”1765”])

Crystal Reports combine a separate Date and time field into 1 field

If you have a situation where you have your date and time stored in 2 separate DB fields. You may wish to combine these, either for display, formatting or sort purposes.

To do so, you simply use the following code.

Where Field1, is your date field and Field2 is your Time Field

 

datetime(Field1,Field2)

 

Categories: Crystal Reports