cumbersome tables...

Anti-Rich

Well-known member
Joined
Jul 1, 2006
Messages
325
Location
Perth, Australia
Programming Experience
1-3
i have a form in which a daily checklist is conducted on a forklift (monday-friday).

now to create a field for every single checkbox i think is a waste of time and effort, and there should be a much much better way

my idea was to create a field for each label on the form, as an nvarchar (or similar) and store in it a string containing the 0 or 1 (false or true from the checked method of a checkbox) for a day, adn then simply reading the string splitting it up when i need to read it and assigning it to relevant text boxes.

for example... there is a field called 'Obvious Damages' adn within that field for a certain date it would have the following values representing a week...

1,0,1,1,1,0,1

what do you guys (or girls) think about this method of tackling this? i ask on the forum because there might be a better way to do it, im not sure, so im asking :)

cheers for any feedback
regards
adam
 

Attachments

I also use this kind of control for my user access. But I am storing the value as "101110101" as a continue string in the database (to save spaces). Later I use the code

VB.NET:
Expand Collapse Copy
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] strUserAccess [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2] = "11011100"[/SIZE]
[SIZE=2][COLOR=#0000ff]  Dim[/COLOR][/SIZE][SIZE=2] aChr [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Char[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]  Dim intPos as integer = 0[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]  For [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Each[/COLOR][/SIZE][SIZE=2] aChr [/SIZE][SIZE=2][COLOR=#0000ff]In[/COLOR][/SIZE][SIZE=2] strUserAccess.ToCharArray[/SIZE]
[SIZE=2][COLOR=#0000ff]     If[/COLOR][/SIZE][SIZE=2] aChr = "1"c [/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE]
' Doing something to the array of checkboxes.
[SIZE=2][COLOR=#0000ff]     End [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]  Next[/COLOR][/SIZE]
 
thanks for your reply lingsn

you misunderstood what i asked in the original post (lol although what you suggested i will actually use when handling the string), i asked if there was a better way to structure the table (and the fields in the table), than the way i suggested. cheers for the idea though!

have a good one
adam
 
Back
Top