Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Start position for string searching is less than 0 or not an integer

Status
Not open for further replies.

sjdbmc

IS-IT--Management
Jan 30, 2004
14
GB
I am attempting to retrieve an address from our new database
which is stored at address.address_1.

All of the address lines are stored in this one field and need to be extracted and entered onto my report so I can suppress blank sections.

I have successfully located the separator "char(10)" and returned their positions. I have also managed to extract the individual lines and got the lines to display on my report.

The problem arises when I refresh the data and get the following.

"Start position for string searching is less than 0 or not an integer".

Example formula :-

if {@Address Line 3 Working} = 0 then
trim(mid({address.address_1},{@Address Line 2 Working},{@Address Length}))
else
trim(mid({address.address_1},{@Address Line 2 Working},{@Address Line 3 Working}-{@Address Line 2 Working}))

Working formulas returns location of char(10)

Why does the formula work initially but not on refresh?
 
Have you tried using the Split function?
Code:
stringVar array output;
output := Split({address.address_1},chr(10));
output[1]
Would return the first line.
output[2] would return the second line.
output[3] would return the third line.

You can also use the UBound function to determine how many elements were returned.

~Brian
 
I think you are running into a Null Data problem perhaps...it is hard to tell since you have formulas within formulas...also adding WhilePrintingRecords to each record may help....if it is important that the formulas {@Address Line 2 Working} {@Address Line 3 Working} be evaluated first then use evaluateAfter({@Address Line 2 Working}) and evaluateAfter({@Address Line 3 Working}) in that formula to control the evaluation.

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Brian was on the right track:

whileprintingrecords;
stringVar array Output;
Output := Split({address.address_1},chr(10));
//Then a quick cheat might be a formula containing:
join(Output,chr(13))

Turn on can grow and it will lay out the complete address from within one field.

Or you can just assign each to a seperate formula if you're so inclined.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top