Skip to Content
0

Extract a specific data from a string in Crystal Reports

Dec 05, 2017 at 11:17 PM

72

avatar image
Former Member

Suppose the data is in this format

----------------------------

Variable 7.5% codes

Temporary 10.5% codes

codes 58.5%

10%

20%

----------------------------

How to extract numeric part from the string like

7.5

10.5

58.5

10

20

Please help me on this it's quite urgent....!!!

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

6 Answers

Best Answer
Brian Dong Dec 12, 2017 at 07:30 PM
0

Hi Tanmay,

I guess you didn't see my solution in your comment:

Hi Tanmay,

Change your formula to check if the result is a number like:

stringvar myText := {YourTable.YourStringColumn}; 
stringVar Array myResultArray := Split(Split(myText, "%")[1], " ");

If NumericText (myResultArray[UBound(myResultArray)]) Then 
     myResultArray[UBound(myResultArray)] 
Else "-";

This will display a "-" if there are no numbers to extract.

Brian

Share
10 |10000 characters needed characters left characters exceeded
Brian Dong Dec 06, 2017 at 07:00 PM
1

Hi Tanmay,

Change your formula to check if the result is a number like:

stringvar myText := {YourTable.YourStringColumn}; 
stringVar Array myResultArray := Split(Split(myText, "%")[1], " ");

If NumericText (myResultArray[UBound(myResultArray)]) Then 
     myResultArray[UBound(myResultArray)] 
Else "-";

This will display a "-" if there are no numbers to extract.

Brian

Share
10 |10000 characters needed characters left characters exceeded
Ido Millet Dec 06, 2017 at 03:03 AM
0

stringvar myText := {YourTable.YourStringColumn};
stringVar Array myResultArray := Split(Split(myText, "%")[1], " ");
myResultArray[UBound(myResultArray)];

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Dec 12, 2017 at 11:15 AM
0

Hi Millet,

Thanks it worked but somehow

my data also include only the string like

------------------------

Not Eligible - temp

Eligible - Temp

Variable %

Private based

--------------------------

Note like the line Variable % contains no numbers so the output for this rows should be '-'

right now it's outputting the

-------------

Temp
temp

based

--------------

Can you please help me on this ?

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Dec 06, 2017 at 04:29 PM
0

Hi Millet,

Thanks it worked but somehow

my data also include only the string like

------------------------

Not Eligible - temp

Eligible - Temp

Variable %

Private based

--------------------------

Note like the line Variable % contains no numbers so the output for this rows should be '-'

right now it's outputting the

-------------

Temp
temp

based

--------------

Can you please help me on this ?

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Dec 14, 2017 at 09:20 AM
0
Share
10 |10000 characters needed characters left characters exceeded