Regex in Crystal Reports?

I've read that you cannot use regex in crystal reports, so I'm hoping that any of you can help me with a problem I have.

I have a crystal report on a web page, it get one parameter from the page.(see Code 1)
Where ddlProject is a dropdownlist containing project names.

When used in the selection expert on the report(see Code 2). So that only profiles (e.g. documents) that has the selected project_id will be shown in the report.
Here is where my problem lies.

I have a project with id: 115-20001
Which will display following profiles(see Profiles.jpg)

What I want to do is only display profiles with Project_ID + - + Letter A to Z + -. E.g. 115-20001-F-RD-206-01
So that in the report only will show 115-20001-F-RD-206-01 and 115-20001-A-LA-103-01.

How can I do this?

Thanks in advance:)
Regards
Marius
//Code 1 Default.aspx.cs
ParameterField projectNameParam;
projectNameParam = projectReport.ParameterFields["PROJECT_ID"];
projectNameParam.CurrentValues.AddValue(ddlProject.SelectedItem.Text.ToString());
 
//Code 2 Select Expert formula on report
 {PROFILE.C_PROJECT} = {?PROJECT_ID}

Open in new window

Profiles.JPG
ContestoasAsked:
Who is Participating?
 
mlmccConnect With a Mentor Commented:
Try
{PROFILE.C_PROJECT} LIKE  {?PROJECT_ID} & '-?-*'

mlmcc
0
 
mlmccCommented:
In the data can the letter be other characters?

You can do something like

 {PROFILE.C_PROJECT} STARTSWITH  {?PROJECT_ID} & '-?-'

The ? will match any 1  character.  
If it can be something other than a letter then something will have to be added.
It will work for the sample data.

mlmcc
 
0
 
ContestoasAuthor Commented:
Hi

It can only be one letter, between A and Z

Regards
Marius
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
ContestoasAuthor Commented:
I cant get it to work, it compiles fine, but no data is shown. Maybe it checks for ? instead of characters?
0
 
ContestoasAuthor Commented:
If I insert A instead of ? it will show only the 115-20001-A-LA-103-01 value.
0
 
ContestoasAuthor Commented:
Nope, still doesnt work.

Marius
0
 
mlmccCommented:
Worked for me.

Where are you putting the formula?

mlmcc
0
 
ContestoasAuthor Commented:
Im putting the formula in Report -> Select Expert -> Formula Workshop -> Selection Formulas -> Record Selection.
It looks like it handles the '-?-' as a pure string since if I change the ? to A it will show the profile containing A.

Are there maybe some properties that has to be turned on for the program to not recognize the ? as string?

Which version of crystal reports are you running? Maybe I have an older one?
I'm running Crystal Reports Basic for Visual Studio 2008 v. 10.5.0.0

Marius
0
 
ContestoasAuthor Commented:
Got it to work now, forgot to replace the startswith with like :P

Thanks for all your help :)

Regards
Marius
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.