Solved

Set a error trap in Crystal

Posted on 2011-03-15
9
381 Views
Last Modified: 2012-05-11
I have data used in a crystal report and there is a specific field Serial number that sometimes gets corupt and causes the report to stall when the following formula gets implimented.
Replace(Picture(Split({parc_txt.'SerialNo#'}, '=')[2], '20xx/xx/xx xx:xx'),"'","") and below is the data field example :

'5478=1101210316'
'621=11011118316'
'529'
'5478=1101210316'

So when the second part of the serial number and the equal sign is missing the proccess stops with an error.

I was thinking counting the characters and using an if statement which if true will function else skip.
0
Comment
Question by:John-S Pretorius
  • 6
  • 3
9 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 125 total points
ID: 35143554
That is the only way to do it.  You can't trap errors in formulas

Something like

If InStr({parc_txt.'SerialNo#'}, '=') > 0 then
    Replace(Picture(Split({parc_txt.'SerialNo#'}, '=')[2], '20xx/xx/xx xx:xx'),"'","")
Else
   ""

mlmcc
0
 

Author Comment

by:John-S Pretorius
ID: 35143613
As soon as I introduce the formula this Else "" function somehow fails on the the next instruction when it's read.
0
 

Author Comment

by:John-S Pretorius
ID: 35143694
After this formula is passed I introduce cdatetime on the result and it seems that it doesn't like the if ""
0
 

Author Comment

by:John-S Pretorius
ID: 35143975
OK This is what I did (adding some formula to your edition), again it's most probably not the best or most efficient in any Crystal terms but I'm learning :

If InStr({parc_txt.'SerialNo#'}, '=') < 0 then  
    Replace(Picture(Split({parc_txt.'SerialNo#'}, '=')[2], '20xx/xx/xx xx:xx'),"'","") else
Replace(Picture(Split('9999=1103061206', '=')[2], '20xx/xx/xx xx:xx'),"'","")

then in Group selection I did the following :
length ({parc_txt.'SerialNo#'}) >5
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Closing Comment

by:John-S Pretorius
ID: 35143979
Added some aditional workaround but your guidance was key.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 35144101
FYI - InStr cannot be < 0 as it is 0 when the search string isn't found.  The Len is what solved it for you.

mlmcc
0
 

Author Comment

by:John-S Pretorius
ID: 35146996
Thank you for pointing that out. I do see this now, it seems by just using the Length statement in Grouping filters it out before the formula can evaluate it.

very good, you have been extremely helpfull - Thank You.
0
 

Author Comment

by:John-S Pretorius
ID: 35147011
Curios mlmcc how do we make readers aware of this since I awarded the solution to you but in my case it may be easier just to filter it out ? or is it just my original question that was not clear enough. What is your thoughts.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 35150169
I think it will be useful as is but you could click the REQUEST ATTENTION link in the question body and explain what you want done.  The moderators can accept your comment and award the points to my comment as an assisted answer.

mlmcc
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

707 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

16 Experts available now in Live!

Get 1:1 Help Now