PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Best/Easiest way to store a CheckBox group with 4 options?
Best/Easiest way to store a CheckBox group with 4 options?
Iniciado por guest, 06,mar. 2015 23:19 - 6 respuestas
Publicado el 06,marzo 2015 - 23:19
Is there a ScreenToFile() way of storing the selected check boxes? Or do I need to set the type to string or int and parse the data each time I need to access the checkbox values?
[attachment 1370 Capture.PNG]
Publicado el 07,marzo 2015 - 08:20
Hi, best way is to associate (= link) the checkbox to an array of integers.
Publicado el 09,marzo 2015 - 15:05
And store it in the database as a string? "1,2,3,4"
Publicado el 09,marzo 2015 - 16:06
Hi Curtis,

What Guenter meant is described here: <a class="ExternalLink" rel="nofollow" target="_blank" href="http://doc.windev.com/en-US/?1013152">http://doc.windev.com/en-US/&hellip;</a> (Look at the 2nd use case, which is your case.)

Best regards,
Alexandre Leclerc
Publicado el 09,marzo 2015 - 16:08
Thanks!
Publicado el 09,marzo 2015 - 20:33
Hi,

In my honest opinion the easiest way is to sore these things is adding the options to the database and just store them ( little to no coding.)

Do not add one control ( then you need the array stuff) add 4 controls. then you can just bind and you are done

Just add a booleon to the analysis ( for each control ) you can databind the controls if you want to use screentofile() /filetoscreen() to achief even less coding
it stores a 1 if checeked and a 0 if it isnot checed

Screentofile and filetoscreeen will to the job

regards

Allard

Ps if you need be able to dynamicly add more options then this might not be the way to go
Publicado el 09,marzo 2015 - 22:31
Hi,
ScreenToFile(..) and FileToScreen(..) indeed do work quite fine with checkbox-arrays as well. Binding to a file item is as easy as with a single checkbox!

One caveat: e.g. MySQL and others do not offer array-items as HFSQL does. If you plan to switch over to MSSQL or MySQL then you have to avoid arrays in the file definition.