Advertisement

06.11.2008 at 04:43PM PDT, ID: 23477852
[x]
Attachment Details

Crystal Reports XI string function problem

Asked by chamlight in Crystal Reports Software, Databases Miscellaneous, Business Objects

Tags: crystal reports, XI

I'm trying to do a string manipulation in CR XI R2 and it's not working for me.  It's probably simple and I'm overcomplicating it.

I have a string value (named "itemCode") composed of letters and numbers which I pass into a formula field with the attached code.  I need to conditionally "truncate" or cut a certain number of the last characters off and display them (truncated and full) in my report.  In most of my cases the code works, but with a value of R4.0022, I would like to end up with R4.002 but what I'm getting is R4.00. The line that is causing me problems is:
if {chaProducts.itemCode} like "*.????" then replace({chaProducts.itemCode},right({chaProducts.itemCode},1),"")

It seems to replace the number 2 wherever it finds it, but I only want it to cut off the final 2.  So I would like to replace the 2 only once, starting at the end.  I know I can tell a "replace" function how many times to replace a string but can I tell it to start looking at the end of the string and work backwards?  Another clever function perhaps?  Any help would be appreciated.
thanks
Start Free Trial
1:
2:
3:
if {chaProducts.itemCode} like "*.000?" then replace({chaProducts.itemCode},right({chaProducts.itemCode},5),"")
    else if {chaProducts.itemCode} like "*.????" then replace({chaProducts.itemCode},right({chaProducts.itemCode},1),"")
        else {chaProducts.itemCode}
[+][-]06.11.2008 at 06:04PM PDT, ID: 21765380

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]06.11.2008 at 06:50PM PDT, ID: 21765613

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]06.12.2008 at 07:16AM PDT, ID: 21769684

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.16.2008 at 06:27AM PDT, ID: 21793323

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Crystal Reports Software, Databases Miscellaneous, Business Objects
Tags: crystal reports, XI
Sign Up Now!
Solution Provided By: James0628
Participating Experts: 3
Solution Grade: A
 
 
[+][-]06.16.2008 at 04:01PM PDT, ID: 21798298

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.16.2008 at 05:42PM PDT, ID: 21798740

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.16.2008 at 09:30PM PDT, ID: 21799586

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.16.2008 at 10:25PM PDT, ID: 21800036

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.17.2008 at 07:25AM PDT, ID: 21803338

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.17.2008 at 02:07PM PDT, ID: 21807498

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.17.2008 at 02:20PM PDT, ID: 21807614

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628