Topic: #Checkbox and #Auto-Number

Hi all

I want to add checkbox in a table grid and found multiple references on how to do it, but none explain how they create the #Checkbox and #Auto-Number.

I've been on this for a while but can't make sense of it..

I linked an image showing what I want, which are in the table grid.
TKS.

Post's attachments

Attachment icon t5.png 50.29 kb, 16 downloads since 2025-03-29 

Re: #Checkbox and #Auto-Number

Hi Jeff,
1.
The 'auto number' option simply adds a column to the tablegrid so you can easily identify where you are (ie "I'm on row 67");  basically, it's just a sequence number. 
Note that when you resort the tablegrid, the auto numbers don't get re-sorted - that's the whole point.
2.
The 'checkbox' option allows you to select random rows from the tablegrid that you might then want to perform some sort of action on ('filter' by rows that have been 'checked', export 'checked' rows to Excel etc etc or, as in the attached example, you use the checkbox to select all the rows that you want to copy into a Bill of Materials).
Be aware that neither the 'auto number' nor the 'checkbox' forms any part of the actual data structure so you won't see them if you examine the data using SQLite or something like that - they're just temporary while the program is running.
If anything's not clear, just shout.
Derek.

Post's attachments

Attachment icon copy cells by checkbox.zip 440.65 kb, 47 downloads since 2025-03-30 

Re: #Checkbox and #Auto-Number

Thanks Derek
Thats good.

Side question. Is it possible or fisable to have the checkbox data transfered to another Grid table. I would assume there would be SQL programming necessary ?

At the end, i need to do some searchs which i feel is more sold with grids then with a memo box.

Re: #Checkbox and #Auto-Number

Hi,
A couple of options to have a go at (see the attachment for a couple).
The first example uses a checkbox to filter the data (just check random rows of data and then click the 'filter by checkbox').  When you're finished working on the list of filtered rows, just click the 'filter by checkbox' again.
The second example takes a different approach (and doesn't actually use a checkbox but uses arrow indicators as being a bit more intuitive for the end-user).
There are other options as well - probably a case of picking the one that best suits your project and/or your users.
Derek.

Post's attachments

Attachment icon checkbox filter options.zip 904.4 kb, 50 downloads since 2025-04-01 

Re: #Checkbox and #Auto-Number

per stampare da Checkbox?
Derek

Domebil

6 (edited by jeffmtl@hotmail.com 2025-04-06 23:18:38)

Re: #Checkbox and #Auto-Number

Hi Derek

Ive taken the time to study both options and extrapulated some of the ideas, but my problem is that I need to transfer from one table to another.
I've made a little demo of what I am looking for but faced with some sql ISSUES.

I also think there is a question of ID from my customer table that comes into effect, but I dont have enough knowledge or forsite know if that applies.

Here is a small demo of where I am at, and the issue I am getting, before I can continue puzzling out my next steps.

Post's attachments

Attachment icon test.zip 327.26 kb, 23 downloads since 2025-04-07 

Re: #Checkbox and #Auto-Number

Hi Jeff,
A couple of approaches you could take but I've kept it pretty simple in the attached example (so rather than using a checkbox and looping through a tablegrid, it works one row at a time as soon as the row is clicked (there's less script and actually slightly less 'clicks' doing it this way too!)).
But irrespective of how you work it, your old data structure was incorrect - you can't simply add records from the 'items' table to the 'clients' table because you don't know how many items the client is going to be associated with (1, 3, 100 etc?) so where are you going to store them?  That's one of the main reasons for using a relational database.
In your case, you need to create a new table ('clientitems' in the attachment) that holds relationships to both the 'clients' table and the 'items' table.  The 'clientitems' table is maintained via the script (look for the 'sqlexecute insert' and 'sqlexecute delete' lines - the rest of the script is just a bit of duplicate record checking and cosmetic stuff to make it a bit more user friendly).
Shout if anything's not clear.
Regards,
Derek.

Post's attachments

Attachment icon jeffmtl.zip 440 kb, 41 downloads since 2025-04-09