Page 1 of 1

Logic multiselect

Posted: May 13th, 2020, 9:57 am
by AMR Burkina
Bonjour,
Depuis longtemps, j'essaie d’intégrerImage[/img] une logic multiselect, mais je n'arrive pas. Voici la logique que j'utilise:
PROC GLOBAL

//a counter variable et la variable conteur qui nous permet de faire la boucle
numeric ctr ;
//la variable qui prend en charge la case à cocher
numeric i ;
//this variable is used for check box manipulation etde alphabet pour la multiselect
String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
//cette fonction est notre check box en fait ici il n y a rien et la même boucle peut être utilisée pour plusieurs questions
Function VerifyCheckBoxCodes(string checkBoxField)
String validOption = " " + alphabet [i :length(checkBoxField)] ;
do ctr = 1 while ctr <= length (checkBoxField)
if pos(checkBoxField[ctr :1], validOption )=<>0 then
errmsg ("option '%s'is invalid."checkBoxField (ctr ;1]) ;
reenter ;
endif ;

Après la compilation, l'erreur ci-après apparaît:
ERROR(VerifyCheckBoxCodes, 13): Invalid arithmetic or conditional expression

Je suis en attente de vos observations! Et merci d'avance.

Re: Logic multiselect

Posted: May 13th, 2020, 10:33 am
by josh
Vous avez toujours des erreurs de syntaxe dans la logique:

- =<> n'est pas valide, je crois que vous voulez <> (different de)
- Il manque la virgule entre "option '%s'is invalid." et checkBoxField
- checkBoxField (ctr ;1] n'est pas valide, peut-etre checkBoxField[ctr:1]
Function VerifyCheckBoxCodes(string checkBoxField)
   
String validOption = " " + alphabet [i :length(checkBoxField)] ;
   
do ctr = 1 while ctr <= length (checkBoxField)
       
if pos(checkBoxField[ctr :1], validOption )<>0 then
            errmsg
("option '%s'is invalid.", checkBoxField[ctr:1]) ;
           
reenter ;
       
endif ;
   
enddo;
end;

Re: Logic multiselect

Posted: May 13th, 2020, 4:35 pm
by AMR Burkina
Bonjour Josh;
Merci pour les corrections! Je vais utiliser cette nouvelle logique!
AMR

Re: Multiselect Logic

Posted: January 12th, 2021, 4:06 am
by nkohlat
this logic won`t work
if AGF_CHK in 1
then
skip to MJJ-MULT1;
endif;

the question is in alphanumeric and the value sets labeled in numeric

please help logic wont compile application

Re: Logic multiselect

Posted: January 12th, 2021, 8:15 am
by josh
If AGF_CHK is multiselect (checkbox) then the item is alphanumeric and you can't use "in". You can use the ischecked() function instead https://www.csprousers.org/help/CSPro/i ... ction.html.

Next time please post a new question rather than responding to an old thread.