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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String length is less than 0 or not an integer

Status
Not open for further replies.

adnil

Technical User
Oct 29, 2003
50
0
0
GB
Hi

I have the below formula:

WhilePrintingRecords;
local stringvar marks:={NEW_BASE_TIME.TERM_TEXT};
local numbervar A;
local stringvar display;
local numbervar iloop;
local numbervar startpos;
local numbervar endpos;

//start position of slice of string required
if {NEW_BASE_TIME.START_DATE} >= {?Start Date} or
{ROUTE_COST.START_DATE} >= {?Start date} then startpos := 1 else startpos := ({?Start Date} - {NEW_BASE_TIME.START_DATE})+1;

//end position of slice of string required
endpos:={@datediff};

//marks required
marks := mid({NEW_BASE_TIME.TERM_TEXT},startpos,endpos);

//assign each mark to appropriate counter
for iloop := 1 to len(marks) do
(
if uppercase(mid(marks,iloop,1))="A" then A := A +1
);

A

When I run the report, I am getting String length is less than 0 or not an integer on
mid({NEW_BASE_TIME.TERM_TEXT},startpos,endpos)

Can someone let me know what I have missed out please?

Thank you.

Lin
 
Cannot say for sure. But the first thing I would check is to make sure your startpos is not negative or past the end of the string (i.e., length of string is 8 and startpos is 9) and endpos is not larger than the length of the string. Also I do not see the code for the {@datefiff} formula.
 
Are you re-initializing all of your variables after each record/group?
 
FYI: Since the variables are local and assigned in the formula, I would not think that would be necessary.
 
As kray4660 pointed out, the code used for the {@datediff} formula has not been provided.

My money is that the problem comes from there.

Pete
 
Hi all,

{@datediff}
DateDiff ("d",{@start date} ,{@end date} )+1

{@start date}
if {NEW_BASE_TIME.START_DATE} >= {ROUTE_COST.START_DATE} and
{NEW_BASE_TIME.START_DATE} in {?Start date} to {?End date}then {@term start date} else
if {ROUTE_COST.START_DATE} >= {NEW_BASE_TIME.START_DATE} and
{ROUTE_COST.START_DATE}in {?Start date} to {?End date} then {@route start date} else
{?Start date}

{@end date}
if {@term end date} <{@route end date} then {@term end date} else {@route end date}

{@term start date}
if {NEW_BASE_TIME.START_DATE} in {?Start date} to {?End date} then {NEW_BASE_TIME.START_DATE}
else {?Start date}

When I take remove my initial formula in this post {@analysis}, I am getting the same error for:
{@mid}
mid({NEW_BASE_TIME.TERM_TEXT},1,{@datediff})

Thank you all.

Lin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top