Solved

Conditional Text in Crystal

Posted on 2016-09-27
4
31 Views
Last Modified: 2016-09-28
I have a table in which I am writing a crystal report for.  Everything has been created in Crystal and this is the last step.  We have a field that gives a name which is linked in the table to a number.

The table would simply look like this:


Number|Name
1|     John
2|     Mike
3|     Bill
4|     Joe
5|     Bob
6|     Mike

In the Crystal Report only the Name field is showed in the details section.

Is there any way to have the text change to bold with asterisks if the name Mike comes up?

So it would look like this for example:

Joe
Bob
John
*Mike*

Additionally, is there any way to have a text box appear only next to the name Mike that would simply look like [!] for example.

Thank you for all your help,

Mike
0
Comment
Question by:Michael Graham
  • 2
  • 2
4 Comments
 
LVL 34

Accepted Solution

by:
James0628 earned 500 total points
ID: 41819551
Are you literally talking about only the name Mike?  You show Mike twice in your "table" (as #2 and #6), so at first I thought that you were trying to highlight any name that was in the table more than once, but you didn't mention that.

 Assuming that you are just looking for "Mike", you could create a formula (in the Field Explorer) like the following to add the "*"s and "[!]", and put that formula on the report:

if {Name field} = "Mike" then
  "*" + {Name field} + "*   [!]"
else
  {Name field}

Open in new window


 You could put the "[!]" in a separate text box, like you mentioned, but it's simpler to just add it to the name when you add the "*"s.  If you really want/need a separate text box for the "[!]", you could use logic similar to that above.  If you need help with that, let me know.

 To make that field bold, right-click on the field, select "Format Field", select the Font tab, click the formula (X+2) button beside Style and enter a formula like this:

if {Name field} = "Mike" then
  crBold
else
  crRegular

Open in new window


 James
0
 

Author Closing Comment

by:Michael Graham
ID: 41820961
Perfect! That worked! Thank you

Mike
0
 

Author Comment

by:Michael Graham
ID: 41820963
sorry I should have mentioned the second formula is the one I used...However I like the first formula and I think I will be using it for future reports.
0
 
LVL 34

Expert Comment

by:James0628
ID: 41820978
You're welcome.  Glad I could help.

 James
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now