Avatar of jspc
jspc
Flag for Australia asked on

Crystal Reports - Trim Data

Hello,

I’m wanting to trim a field.

I have a product code like the following:
100003.BLK.SML
104+YEL+LRG
1005-GRE-XLG

I need to trim the code so it appears like below taking into account the following characters . + / * -

100003
104
1005

The code length can’t exceed 16 characters.

Thank you
Crystal Reports

Avatar of undefined
Last Comment
jspc

8/22/2022 - Mon
Ryan Chong

what's your backend database? are you able to manipulate the data from backend source instead?
jspc

ASKER
SQL Database
Mike McCracken

DO you just need the leading numeric part?
If so use

Val({YourField})

Open in new window


If you want it as a string use

CStr(Val({YourField}),0)

Open in new window


mlmcc
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
jspc

ASKER
yes just front front part as per my example
ASKER CERTIFIED SOLUTION
Mike McCracken

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Mike McCracken

My String formula will result in a comma

use
1:CStr(Val({YourField}),0,'')

Open in new window

jspc

ASKER
Bingo! Thanks
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.