Page 1 of 1

Substring Oddity

Posted: Thu May 19, 2011 10:04 am
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)}

Substring Oddity

Posted: Fri May 20, 2011 6:42 am
by Ivan
Hello,

Let us know if you need any additional help.

Thank you.