Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does Crystal have anything like MsgBox()?

Status
Not open for further replies.

GZook

Programmer
Apr 14, 2003
42
US
In debugging a report, I need to investigate the values of Shared Variables, and would prefer to do so without having to return them as the result of the formulas.

Can this be done?

 
I don't know of any other way than what you described (dropping the results of the formulas onto the report) without third party tools. I think CR9 is supposed to have some of this capability (see A New Formula Debug/Trace Window in Crystal v9 from Ken Hamady's Dec 2002 newsletter), but I don't have it up and running yet.

The only third party report debugger I know of is Report Debugger from Cortex Systems in Australia. It looks pretty good, but haven't used it myself. Perhaps someone else has, and can give you an opinion.

You might be able to find something else on Ken Hamady's Bookmarks page.

-dave
 
Unfortunately Crystal doesn't have many tools for programming.

Even CR 10 is weak.

Adding a formula isn't much work though, copy and paste it in. Sometimes I add in sections during dev for this purpose, and then delete them afterwards.

-k
 
You can do it inside a UFL. If you can write VB, I can send you the source code - it's one line inside a VB function.

I included it for fun in my registry UFL.

But be careful. I tried it on a report running on CR8 web delivery and it killed the server. Apparantely a windows service doesn't like a message box being generated by a report.

Editor and Publisher of Crystal Clear
 
Chelseatech wrote:
<<You can do it inside a UFL. If you can write VB, I can send you the source code - it's one line inside a VB function.>>

Thanks, I'm interested. My report is in-house on a LAN, not on the internet. One question, and I should probably know this, but what is a UFL?

Synapsevampire wrote:
<<Sometimes I add in sections during dev for this purpose, and then delete them afterwards.>>

Thanks,

Using that process, I was able to find out what's going on, but not why?!.

I'm working with Crystal 8.5

I have a Group Header split into 2 sections.

I also have two Shared Variables defined as Boolean and 4 formulas in Basic Syntax to 1: initialize, 2: display variable gDisplayCSRName, 3: display variable gSuppress and 4: Change the values.

In Group Header 1a, I have the following formulas Left to Right:

1: Init Vars

Code:
Shared gDisplayCSRName As Boolean, gSuppress as Boolean
gDisplayCSRName = True
gSuppress = False
Formula = " "

2: display gDisplayCSRName

Code:
Shared gDisplayCSRName AS Boolean
Formula = gDisplayCSRName
The formula returns True, which is correct

3: display gSuppress

Code:
Shared gSuppress AS Boolean
Formula = gSuppress
The formula returns False, which is correct

In Group Header 1b, I have the following formulas Left to Right:

4: Change the values

Code:
Shared gSuppress AS Boolean, gDisplayCSRName as Boolean
'gDisplayCSRName was set True in Formula 1
If gDisplayCSRName Then
    gDisplayCSRName = False
End If
'gSuppress was set False in Formula 1
If Not gSuppress Then
    gSupress = True
End If
Formula = " "

2: display gDisplayCSRName

Code:
Shared gDisplayCSRName AS Boolean
Formula = gDisplayCSRName
In this case, the formula returns the incorrect value of True. The value of gDisplayCSRName was changed by formula 4 and should be False.

3: display gSuppress

Code:
Shared gSuppress AS Boolean
Formula = gSuppress
In this case, the formula returns the incorrect value of False. The value of gsuppress was changed by formula 4 and should be True.

Why don't the variables hold their changed values?
 
Change your display formulas in section 1b to Evaluate after the formula used to reset the variables

Code:
EvaluateAfter({@Reset});
Shared gDisplayCSRName AS Boolean
Formula = gDisplayCSRName 

and 

EvaluateAfter({@Reset});
Shared gDisplayCSRName AS Boolean
Formula = gDisplayCSRName

HTH

Gary Parker
Systems Support Analyst
Manchester, England
 
You may want to consider using two techniques to control when these formulas get evaluated:

1. Insert WhilePrintingRecords; as the 1st line in the formula to ensure variables are evaluated in the sequence of displayed records rather than in the sequence of records read from the database.

2. Use the EvaluateAfter() function to control which formulas evaluate first when several formulas on the same section need a specific evaluation sequence.

Cheers,
- Ido


CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
It's about time us brits beat you to something...... [2thumbsup]

Gary Parker
Systems Support Analyst
Manchester, England
 
Gary,

What kind of market position does Crystal have among report generators in England? Just curious.

Regards,
- Ido



CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Ido

if you take skills required in the current job market for MIS and data analysis as a benchmark. Most companies are advertising for people with either Crystal or Cognos experience. (Luckily I have experince in using both)

However I think Cognos are concentrated more on the enterprise wide web deployment, and may have the edge on Crystal Enterprise. But for standalone report writing Crystal leads the market.

Regards

Gary Parker
Systems Support Analyst
Manchester, England
 
Gary,

Thanks. Sounds like a similar situation to the US.
By the way, Cognos recently announced very good financial results.

In my undergraduate course I teach both Crystal and Cognos (PowerPlay, Transformer, Impromptu, and Impromptu Administrator) as well as a few other nifty tools (Monarch, KnowledgeSeeker,...). It's good to know how the market is shaping up so I can adjust the curriculum accordingly.

Regards,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top