Substring Oddity

Stimulsoft Reports.NET discussion
Post Reply
Troy7k
Posts: 9
Joined: Tue Mar 10, 2009 3:59 am
Location: Delaware, OH

Substring Oddity

Post by Troy7k »

So we use the Stimulsoft software for report generation only. We do minor code tab revision/addition but mainly just work through the interface for the reports. I had a request to print a field/variable, which is a string, they only want to see the text after a certain character. Easy, right, so I use the 'Substring' function, find the location of the 'certain character' (which is a '-') ... it works fine but includes the "-" character. Again, easy, I'll just add to the IndexOf function. Nope .. doesn't work. I can subtract but not add .. here, the below code works fine, I put the minus sign in there to subtract .. works great .. but if I put the plus sign for adding ... won't work, get a text evaluation error.

{Substring(Jobs.JobNumber,((Jobs.JobNumber.IndexOf("-"))-1),Length(Jobs.JobNumber)-Jobs.JobNumber.IndexOf("-"))}

Any suggestions as to why I can't add to the Jobs.JobNumber.IndexOf ... but I can subtract?
--------------------------

Sorry, I figured it out, I have to balance the formula out. Using the Substring function requires that I don't go outside the total length of the string, so if I add to one I have to subtract from the other ..

{Substring(Jobs.JobNumber,((Jobs.JobNumber.IndexOf("-"))+1),Length(Jobs.JobNumber)-Jobs.JobNumber.IndexOf("-")-1)}
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Substring Oddity

Post by Ivan »

Hello,

Let us know if you need any additional help.

Thank you.
Post Reply