PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Table question
Table question
Débuté par John Marrone, 07 oct. 2004 16:10 - 3 réponses
Posté le 07 octobre 2004 - 16:10
Hi and help
I have a table that will only hold no more than 6 to 25 records at any one time. This table is linked to a query. Column 1 is a boolean value which displays a checkbox. Only one of these records can have a true value so only one record will have a check in the checkbox. Here's my question. I want to let the user click the checkbox on a record with out a check and at that moment set all the other records for this column to false and the one clicked on to true. So what I am doing is sort of like radio buttons. Only 1 record can have a true value for this field (column). Here is the code I am using but doesn't work.
vnCurRow is int
vnCurRow = CurrentSubscript()
HReadFirst(qryPPLines)
WHILE NOT HOut(qryPPLines)
qryPPLines.Selected = False
HReadNext(qryPPLines)
END
HReadFirst(qryPPLines)
HForward(qryPPLines,vnCurRow)
qryPPLines.Selected = True
TableDisplay(MySelf)
This is in the left mouse button up code.
Can someone please help. You would think this would me easy.
Thanks
John Marrone
Posté le 07 octobre 2004 - 17:24
Hello John,
don't you have to rewrite the records with HModify() after setting qryPPLines.Selected to False ?
Greetings, Stefan
Hi and help
I have a table that will only hold no more than 6 to 25 records at any one time. This table is linked to a query. Column 1 is a boolean value which displays a checkbox. Only one of these records can have a true value so only one record will have a check in the checkbox. Here's my question. I want to let the user click the checkbox on a record with out a check and at that moment set all the other records for this column to false and the one clicked on to true. So what I am doing is sort of like radio buttons. Only 1 record can have a true value for this field (column). Here is the code I am using but doesn't work.
vnCurRow is int
vnCurRow = CurrentSubscript()
HReadFirst(qryPPLines)
WHILE NOT HOut(qryPPLines)
qryPPLines.Selected = False
HReadNext(qryPPLines)
END
HReadFirst(qryPPLines)
HForward(qryPPLines,vnCurRow)
qryPPLines.Selected = True
TableDisplay(MySelf)
This is in the left mouse button up code.
Can someone please help. You would think this would me easy.
Thanks
John Marrone
Posté le 07 octobre 2004 - 17:47
Hi John,
If the checkbox is the only entry field in the table.
In the row entry code point:
i is int
FOR i = 1 TO TableCount(Table1)
Column1[i]=False
END
MySelf=True
I'm sure there are better ways to do it but I am drawing a blank.
HTH
Bert

Hi and help
I have a table that will only hold no more than 6 to 25 records at any one time. This table is linked to a query. Column 1 is a boolean value which displays a checkbox. Only one of these records can have a true value so only one record will have a check in the checkbox. Here's my question. I want to let the user click the checkbox on a record with out a check and at that moment set all the other records for this column to false and the one clicked on to true. So what I am doing is sort of like radio buttons. Only 1 record can have a true value for this field (column). Here is the code I am using but doesn't work.
vnCurRow is int
vnCurRow = CurrentSubscript()
HReadFirst(qryPPLines)
WHILE NOT HOut(qryPPLines)
qryPPLines.Selected = False
HReadNext(qryPPLines)
END
HReadFirst(qryPPLines)
HForward(qryPPLines,vnCurRow)
qryPPLines.Selected = True
TableDisplay(MySelf)
This is in the left mouse button up code.
Can someone please help. You would think this would me easy.
Thanks
John Marrone
Posté le 07 octobre 2004 - 19:12
Hi Seafan
Your right and also you need to create the query with the "hQueryDefault + hModifyFile" parameter. But thanks for pointing me in the right direction. I had gone to a part of my program where I wasn't dealing with querys for a while and just forgot to give myself the right to change a querys records.
Thanks
John

Hello John,
don't you have to rewrite the records with HModify() after setting qryPPLines.Selected to False ?
Greetings, Stefan
Hi and help
I have a table that will only hold no more than 6 to 25 records at any one time. This table is linked to a query. Column 1 is a boolean value which displays a checkbox. Only one of these records can have a true value so only one record will have a check in the checkbox. Here's my question. I want to let the user click the checkbox on a record with out a check and at that moment set all the other records for this column to false and the one clicked on to true. So what I am doing is sort of like radio buttons. Only 1 record can have a true value for this field (column). Here is the code I am using but doesn't work.
vnCurRow is int
vnCurRow = CurrentSubscript()
HReadFirst(qryPPLines)
WHILE NOT HOut(qryPPLines)
qryPPLines.Selected = False
HReadNext(qryPPLines)
END
HReadFirst(qryPPLines)
HForward(qryPPLines,vnCurRow)
qryPPLines.Selected = True
TableDisplay(MySelf)
This is in the left mouse button up code.
Can someone please help. You would think this would me easy.
Thanks
John Marrone