[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Set a error trap in Crystal

Posted on 2011-03-15
9
Medium Priority
?
394 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 101

Accepted Solution

by:
mlmcc earned 375 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
How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

 

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
 

Author Closing Comment

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

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 101

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

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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 …
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

834 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