Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Exclude Part of Field Name Post Reply Post New Topic
Author Message
bjfils
Newbie
Newbie


Joined: 03 Apr 2016
Online Status: Offline
Posts: 32
Quote bjfils Replybullet Topic: Exclude Part of Field Name
    Posted: 08 Aug 2022 at 10:11am
We're trying to automate a process in our manufacturing facility and want to group some data together in a Crystal Report based on data in a field. The issue the last character in the field name is irrelevant and we want to exclude it. Let's say the data is the field might be AB5X7IJKL1 and AB5X7IJKL2. The only difference is the last character in the data. I want to be able to group everything that is AB5X7IJKL together, ignoring the 1 or 2 at the end of the field. The data in the field will be 10 characters and the last character before the one I want to ignore will always be an L, which will never be elsewhere in the field.

I can group the report by the full unique data in the field, but haven't found a way to group by the first 9 of the 10 characters in the field. It's probably an easy fix, but I only know enough about Crystal to be dangerous.

Thanks!
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 23 Aug 2022 at 6:49am
Try creating a formula like this and then grouping on it:


Left({MyTable.MyField}, 9)


If there are some records where you need to look for the L and don't want to strip off the last character if the L isn't there, you could use a formula like this:

if InStr({MyTable.MyField}, 'L') = Length({MyTable.MyField}) - 1 then
Left({MyTable.MyField}, Length({MyTable.MyField}) - 1)
else
{MyTable.MyField}


-Dell
IP IP Logged
bjfils
Newbie
Newbie


Joined: 03 Apr 2016
Online Status: Offline
Posts: 32
Quote bjfils Replybullet Posted: 23 Aug 2022 at 9:23am
Thanks. I'll give that a shot. I found a workaround that's a little kludgy, but works.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.063 seconds.