Solved

# How to Group strings in Crystal Reports by wild cards

Posted on 2011-10-11
Medium Priority
258 Views
I want to be able to create a group based on a formula..

Basically there is a list of Jobs in the database such as;
10269-1
10452-1
R10452-1-1
R10269-1-2
10367-1
10467-2
R10367-1-1
R10269-1-1

Basically I would like to group all the jobs that contain the core number which would be 10269, 10452, 10367, etc. with there rework jobs (these start with 'R')

So in the group for 10269-1 would also include R10269-1-2 and R10269-1-1
and the group for 10452-1 would also include R10452-1-1
and the group for 10367-1 would also include R10367-1-1.

Thanks in advance for the help!
0
Question by:SeyerIT
• 3
• 2

LVL 101

Expert Comment

ID: 36952338
Try a formula like this for the group field

If Left({JobNumberField},1) = 'R' then
Mid(Split({JobNumberField},'-')[1],2)
Else
Split({JobNumberField},'-')[1]

mlmcc
0

LVL 2

Author Comment

ID: 36955935
Thats actually very close! However, there are also Core Jobs that may also end in a -2. And if possible, I would like for the complete core job to always display, e.g. 10358-1, 10269-2, etc.

In these two examples there could be rework jobs tied to them that would look like;
R10358-1-1
R10358-1-2
R10269-2-1
R10269-2-11

So currently the Formula is only displaying the job #'s as 10358 and 10269. And the 10269 is throwing the 10269-2 in with the 10269-1 job when the -1 and the -2 are actually two different jobs.

Hopefully this makes since and doesn't complicate the formula too much..

0

LVL 2

Author Comment

ID: 36955950
Oh, and I should mention, (just realized), some of the Rework jobs have letters in the end. I hope this doesn't throw things off too much. They look like the following;

R10452-1-10B
R10452-2-34C
R10452-4-19A

The core job will always be the #####-# though and Rework jobs tied to the Core job will always contain that Core job with an added -# at the end and an 'R' at the beginning.
0

LVL 19

Expert Comment

ID: 36956419
Are the job numbers always 5 digits long ?
0

LVL 19

Accepted Solution

GJParker earned 2000 total points
ID: 36956534
Try This

Local StringVar strTemp := Left({JobNo},Len({JobNo}) - Instr(strReverse({JobNo}), '-'));

If strTemp[1] = 'R' Then
Right(strTemp, Len(StrTemp)-1)
Else
{JobNo}
0

LVL 2

Author Comment

ID: 36956920
Sometimes they may also have another preceding letter which would either be an 'X' or an 'E'.
X10452-1
X10234-2
E10109-1
E10408-11

Reworks for those jobs would be;
RX10452-1-1
RX10234-2-1
RE10109-1-5
RE10408-11-3

I applied the formula you provided though and it seems to be working despite the extra letters at the front of the job numbers..

This is going to be great since I can eliminate my Subreport which would make this take about 30 seconds to run.. With this method it doesn't take any time at all!
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
###### Suggested Courses
Course of the Month15 days, 5 hours left to enroll