×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

#### Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
To Your Posts
• Keyword Search
• One-Click Access To Your
Favorite Forums
• Automated Signatures
On Your Posts
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

# help in while loop

 Forum Search FAQs Links MVPs

## help in while loop

(OP)
whenever I am trying to save the formula I am getting the error
"A number is required here"
and the cursor is staying just after else.

EvaluateAfter ({@issuer_test});
numberVar LengthIssuer1 ;
global stringvar issuer1_for_test;
global stringVar array  issuer1_part:=['a','b','c','d','e'];
numbervar i:=1;
numbervar j:=1;
numbervar l:=0;

LengthIssuer1:=Length (issuer1_for_test);

If LengthIssuer1 <=26 then
(
issuer1_part[1]:=issuer1_for_test;
j:=j;

)
else
(

while j<= LengthIssuer1 do
(
if  mid({@issuer_test},j+26,1)=' ' then
(
issuer1_part:=mid({@issuer_test},j,26);
j:= j+ 27;
i:=i+1
)
)
)
Replies continue below

### RE: help in while loop

You start the IF THen Else with a number and finish on a While, I have seen this before, expressions both sides of the IF Then Else must be the same.

Try splitting into two separate statements eg

EvaluateAfter ({@issuer_test});
numberVar LengthIssuer1 ;
global stringvar issuer1_for_test;
global stringVar array  issuer1_part:=['a','b','c','d','e'];
numbervar i:=1;
numbervar j:=1;
numbervar l:=0;

LengthIssuer1:=Length (issuer1_for_test);

If LengthIssuer1 <=26 then
(
issuer1_part[1]:=issuer1_for_test;
j:=j;

);

(

while j<= LengthIssuer1 do
(
if  mid({@issuer_test},j+26,1)=' ' then
(
issuer1_part:=mid({@issuer_test},j,26);
j:= j+ 27;
i:=i+1
)
)
);

ie replace else with a ; and add a ; at the end of the second part.

Not sure why this happens but splitting like this has worked on simpler formulas for me.

Ian

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

### Reply To This Thread

#### Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!

Already a member? Close this window and log in.