Solved

Crystal Reports - Trim Data

Posted on 2016-09-15
7
64 Views
Last Modified: 2016-09-15
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
0
Comment
Question by:jspc
  • 3
  • 3
7 Comments
 
LVL 51

Expert Comment

by:Ryan Chong
ID: 41800867
what's your backend database? are you able to manipulate the data from backend source instead?
0
 

Author Comment

by:jspc
ID: 41800869
SQL Database
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 41800871
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
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:jspc
ID: 41800874
yes just front front part as per my example
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 41800877
Will the front part always be numeric?
If so, My formula should work.


If it can include non-numeric data then try

SPlit(Replace(Replace({YourField},'+','.'),'-','.'),'.')[1]

Open in new window


mlmcc
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 41800878
My String formula will result in a comma

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

Open in new window

0
 

Author Closing Comment

by:jspc
ID: 41800882
Bingo! Thanks
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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. …
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

830 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