Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
7
Erster Beitrag:
vor 3 Jahren, 3 Monaten
Letzter Beitrag:
vor 3 Jahren, 3 Monaten
Beteiligte Autoren:
Curtis, GuenterP, Allard, Alexandre Leclerc

Best/Easiest way to store a CheckBox group with 4 options?

Startbeitrag von Curtis am 06.03.2015 22: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]

Antworten:

Hi, best way is to associate (= link) the checkbox to an array of integers.

von GuenterP - am 07.03.2015 07:20
And store it in the database as a string? "1,2,3,4"

von Curtis - am 09.03.2015 14:05
Hi Curtis,

What Guenter meant is described here: http://doc.windev.com/en-US/?1013152 (Look at the 2nd use case, which is your case.)

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 09.03.2015 15:06
Thanks!

von Curtis - am 09.03.2015 15:08
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

von Allard - am 09.03.2015 19:33
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.

von GuenterP - am 09.03.2015 21:31
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.