?
Solved

How to display conditional text if it contains reserved keywords and quotation marks.

Posted on 2012-09-12
10
Medium Priority
?
662 Views
Last Modified: 2012-09-13
Hi,
I need to display conditional verbage that contains crystal report reserved keywords (like "or" and "and " and so many others), quotation marks and need to insert field values in between also. How can this be achieved in formula field.

Thanks
0
Comment
Question by:NoorFaz
  • 5
  • 3
  • 2
10 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 38392843
I don't follow what your problem is.

Are you trying to create a formula to display text?
"OR"  displays OR
"AND" displays AND

You can use "  "  or '  ' around text so if you have a sentence like

"John's ...."

'John said "there ..."  '

mlmcc
0
 

Author Comment

by:NoorFaz
ID: 38393379
Its like
" john said it's going to rain or shine in " + '{table.city}' + " and people will be happy"

In this case we have reserved keyword OR and AND and need to include "'" also as a displayed text.
Thanks
I
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 1800 total points
ID: 38393563
Try

" john said it's going to rain or shine in '" + {table.city} + "' and people will be happy"

Once the text is inside " " it no longer is a reserved word.

mlmcc
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
LVL 35

Assisted Solution

by:James0628
James0628 earned 200 total points
ID: 38393896
As mlmcc said, the OR and AND are simply not an issue once you put them in quotes.  There are no reserved words inside quotes.  It's just a string of characters and it can say anything at all.  The only real problem is quotes.  Those can often be handled by switching between double and single quotes, since CR recognizes both as string literals.  If you want the string to include single quotes, put the string in double quotes.  And vice versa.  You can also "escape" quotes by including them twice.  For example, "She says ""Hello"""

 The only problem I see with that last formula that you posted is that you had {table.city} in quotes, so you would get the string "{table.city}" and not the field value.  mlmcc handled that by moving the single quotes that you had around {table.city} into the quoted strings before and after that field.  So, for example, if {table.city} was Denver, you would get

 john said it's going to rain or shine in 'Denver' and people will be happy


 James
0
 

Author Comment

by:NoorFaz
ID: 38394644
Thanks for all the help guys.

I agree with both of you but whenever I'm appending database field to the text, records are disappearing as well as there is no text in the text formula field. Is there any thing else I need to consider while concatenating database field to the text. I have tried using both + and & for appending dynamic data into static text.

Thanks again.
0
 

Author Comment

by:NoorFaz
ID: 38394683
Here is a little update I changed the join type between Parent and child table as left outer join instead of inner join. Now my records are unaffected, but still cannot see the formula text field's verbiage when I append the database field.(Although when I right-click on the field and browsed the data I can see the data in the field).
Any thoughts on that please.
0
 
LVL 101

Assisted Solution

by:mlmcc
mlmcc earned 1800 total points
ID: 38394697
Where are you doing this?

Crystal does NOT delete or change records.

Can the field be NULL?

mlmcc
0
 

Author Comment

by:NoorFaz
ID: 38394735
I went into field explorer, right-clicked on database field, choose database expert and clicked the links tab. Selected the join and right-clicked on it to pick different link types.
As I have mentioned I can see the data in the field by browse data option, so this means its not NULL.
0
 

Author Comment

by:NoorFaz
ID: 38394764
you are right mlmcc when I inserted that appended field on the report itself, it does not show any data in that field, although I can browse data, wierd.
So I'm not using that particualr field, instead I choose another field thats suppose to carry the information I'm looking for.

Thanks for your patience and dedication.
0
 
LVL 35

Expert Comment

by:James0628
ID: 38396079
If the browse option is showing some data, that means that the field sometimes has data in it.  It may be null or blank in the specific records that you're looking at on the report, but some other records have values.

 James
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

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

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 …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month15 days, 10 hours left to enroll

850 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