do varying (help)

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
Guest

do varying (help)

Post by Guest »

Hello,

I seek some help to improve the piece of code below.
It works but I would like to add that if "F" is found with any other letter, then generate an errmsg

I tried many variations but no success.

Thank you for any help

*********************************************
do varying i=1 until i>6
if Q132_DECLCONF[i:1] in "A", "B", "C", "D", "E" then //<------------If any found or any combination found, move to Q134
move to Q134_PROBPERSON;

elseif Q132_DECLCONF = "F" then //<------------If "F" alone, skip to Q135
skip to Q135_PROBPROFES;
endif;
enddo;
*********************************************

I would like to add //If "F" found with any other letter, error message
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: do varying (help)

Post by Gregory Martin »

I would write the code like this, without using a loop:
PROC Q132_DECLCONF

    
if Q132_DECLCONF = "F" then // F alone
        skip to Q135_PROBPROFES;

    
elseif poschar("ABCDE",Q132_DECLCONF) and poschar("F",Q132_DECLCONF) then // F found with another letter
        errmsg("You cannot enter F with another letter");
        
reenter;

    
else
        
skip to Q135_PROBPROFES;

    
endif;
lls
Posts: 109
Joined: December 6th, 2011, 3:11 pm
Location: Geneva, Switzerland

Re: do varying (help)

Post by lls »

Fantastic.

Thank you very much for your help.


Last bumped by Anonymous on July 2nd, 2012, 12:40 pm.
Post Reply