Logic multiselect

Other discussions about CSPro
Post Reply
AMR Burkina
Posts: 16
Joined: January 20th, 2019, 7:55 pm
Location: Gourcy

Logic multiselect

Post 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.
You do not have the required permissions to view the files attached to this post.
josh
Posts: 2403
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Logic multiselect

Post 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;
AMR Burkina
Posts: 16
Joined: January 20th, 2019, 7:55 pm
Location: Gourcy

Re: Logic multiselect

Post by AMR Burkina »

Bonjour Josh;
Merci pour les corrections! Je vais utiliser cette nouvelle logique!
AMR
nkohlat
Posts: 1
Joined: December 7th, 2020, 2:42 am

Re: Multiselect Logic

Post 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
josh
Posts: 2403
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Logic multiselect

Post 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.
Post Reply