Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Need help fast with left/right commands!!! Post Reply Post New Topic
Author Message
ChrisJ517
Newbie
Newbie


Joined: 21 May 2007
Online Status: Offline
Posts: 16
Quote ChrisJ517 Replybullet Topic: Need help fast with left/right commands!!!
     Posted: 01 Aug 2007 at 8:09am
I have the following field.  Field name is CAL.COMPANY.  The data looks like this:
 
       50000                  52293                154328         22,326
 
And yes, the spaces are in there as spaces.  I need to be able to pull the 154,328 number only.  I also had to pull the 50000 out, I did that using a left command and then trim to remove the spaces.  How can I extract the third set of numbers?  Is there a way to do this?  Help!
IP IP Logged
jkwrpc
Senior Member
Senior Member


Joined: 19 Jun 2007
Location: United States
Online Status: Offline
Posts: 432
Quote jkwrpc Replybullet Posted: 01 Aug 2007 at 11:23am
Try the mid string function from the CR Help  for 'Mid'
-----------------------------------
  • Mid (str, start)
  • Mid (str, start, length)
Arguments
  • str is the text string from which one or more characters is being extracted.
  • start is a whole number indicating the position of the first character to extract.
  • length is a whole number indicating the number of characters to be extracted from the text string. This argument is optional. If a value is not specified, the rest of the string from the starting position is extracted.
Returns

Text String

Action

The Mid function returns a specified number of characters from a string. The second argument is the character position where the part to be taken begins. The third argument is the length of the string you want to be taken out. If the third argument is not specified, everything from the start position to the end of the string is extracted.

Typical uses

Use this function anytime you need to extract a set of characters from somewhere in the middle of a text string.

Examples

The following example is applicable to both Basic and Crystal syntax:

Mid("abcdef", 3, 2)

Returns "cd".

---------------------
Only you will know your date well enough to know if this works, but hope it helps
 
Regards,
 
John W.
 
IP IP Logged
ulosawa
Newbie
Newbie
Avatar

Joined: 27 Feb 2008
Location: Malaysia
Online Status: Offline
Posts: 6
Quote ulosawa Replybullet Posted: 27 Feb 2008 at 7:44pm
Hi John,
I got another question which much alike to this. but the problem is my data is not inconsistency in term ogf the length. due to to that i can't use the mid function.
My problem is how can i extract the postcode in the customer table which of course the postcode location will be different from one customer to another.
For examples
1) No 60-3-6 Seri Petaling, 57100 Kuala Lumpur.
2) No 416, Jalan Besar, 84800 Bukit Gambir, Muar, Johor
3) Lot 417 Lorong Mutiasa, Taman Setia, 52500, Kuala Lumpur.
 
 My Questions:
1) how can i extract the post code from the above sample??
2) how can I create a new line after the post code?? meaning that from the result it will show 2 lines first line for postcode and the second is city/location.
 
thanks
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum