Print Page | Close Window

Function to parse out field

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2016
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22638
Printed Date: 20 Oct 2018 at 6:14pm


Topic: Function to parse out field
Posted By: ridershaun
Subject: Function to parse out field
Date Posted: 06 Jul 2018 at 3:49am
I currently use the MID function in a formula to parse out a field in a report to a usable value, but the problem now is we are running out of number combinations which has added an extra value sometimes in the field am parsing.

Today I take '0501741_HY44T90' and using mid ({LOC.NAME},2,1)& mid ({LOC.NAME},4,2)&"-"& mid({LOC.NAME},6,2)& mid ({LOC.NAME},9,2) and create '517-41HY'

I need to now take '09002410HY10010' and create '902-410HY'

I need the formula field to be able to do both since we now have a mix. Any insight that could be offered would be appreciated.

Thanks



Replies:
Posted By: DBlank
Date Posted: 06 Jul 2018 at 6:02am
so are you asking to take one action if the string has a _ and another actin if it does not?
Just adjust your existing code for the
if instr(field,'_')>0 then action 1 else
action 2


Posted By: ridershaun
Date Posted: 06 Jul 2018 at 10:04am
Thank you



Print Page | Close Window