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
Solved

Manipulating string data in Crystal reports

Posted on 2013-02-07
3
496 Views
Last Modified: 2013-02-07
Hello all,

I need some help with a Crystal formula on a string.

I have a string of data I want to manipulate. In Crystal that looks like this:
"ACCT_NBR=123456|iD_NUM=123456"

i want to just pull out the acct_nbr field.  It will always start after the equals sign at the 12th character.  The field length could be 4 to 6 characters then ends with the pipe.

What is the correct function to just pull out the acct_nbr?  I was messing around with a few but could not get it quite right.
0
Comment
Question by:mike-9
  • 2
3 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 38864372
"start after the equals sign at the 12th character."

On my screen the first number occurs at position 10, not 12.

So i would expect to use a formula field like...

numbervar s;
numbervar f;
s:=10;
f:=instr({table.field}, "|");
mid({table.field}, s, f-s)
0
 

Author Comment

by:mike-9
ID: 38864434
You are right about the 10th position in the above post.  I left out a few unneeded characters from data I was working with for simplification.  

Thanks for the tip. That definitely did what was needed.  

I think I found another way to do the same thing from browsing around the site.  

tonumber(Mid(Split({table.field},"|")[1],12))

Thanks again for the quick response!
0
 

Author Closing Comment

by:mike-9
ID: 38864440
Exactly what I was looking for.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Title # Comments Views Activity
Crystal Reports 2008 6 35
Crystal Reports Subreport details 16 66
Field in crystal 2011 is being cut off. 9 41
A string is required here error 20 21
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

856 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