[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
Solved

# Set a error trap in Crystal

Posted on 2011-03-15
Medium Priority
390 Views
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
Question by:John-S Pretorius
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• Learn & ask questions
• 6
• 3

LVL 101

Accepted Solution

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

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

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

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

ID: 35143979
0

LVL 101

Expert Comment

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

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

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

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

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 …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
###### Suggested Courses
Course of the Month13 days, 15 hours left to enroll

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

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