PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Display changes in a table
Display changes in a table
Débuté par Rich Scheuermann, 01 oct. 2005 17:58 - 4 réponses
Posté le 01 octobre 2005 - 17:58
I have a combo box that allows the user to select an organization.
There is a table on the form that shows the contacts for the organization.
When a new organization is chosen in the combo box I want the contacts table to show the contacts for the chosen organization.
I have tried in vain to do this, but the only way I can get the contacts for the chosen organization is to close the form and re open it.
It should be very easy.
Can anyone help?
Thanks
Rich Scheuermann
Posté le 01 octobre 2005 - 18:10
I have a combo box that allows the user to select an organization.
There is a table on the form that shows the contacts for the organization.
When a new organization is chosen in the combo box I want the contacts table to show the contacts for the chosen organization.
I have tried in vain to do this, but the only way I can get the contacts for the chosen organization is to close the form and re open it.
It should be very easy.
Can anyone help?
Thanks

Hello,
If your datasource for the table is a query, try this :
//execute the query with the selected value in the combo-box as parameter
queryname.param1 =
HExecuteQuery(queryname)

//link the query to the table
Tablename..BrowsedFile="Queryname"
Bart
Posté le 01 octobre 2005 - 20:18
Hi,
You can define a filter field in the table description.
I believe that with the ..Filter attribute of the table you can assign the filter value and refresh the table with TableDisplay(TableName, taInit).
Cheers,
Peter
Posté le 01 octobre 2005 - 22:21
Peter,
I am not sure what you mean by the ..Filter attribute of the table.
This is what I have in the init of the table
hfilter(ORGCONTS,ORGID,Projects.AEId)
// Projects.AEId is a numeric field that has the id of an organization.
In the exit code of the drop down I have
hfilter(ORGCONTS,ORGID,Query_Architects.id)
// Query_Architects is the source for the drop down,
// and Query_Architects.id is the id of the organization.
HActivateFilter(ORGCONTS)
TableDisplay(Table_ORGCONTS, taInit)
But, nothing is changed in the table until I close the form and re open it.
Thanks for your interest.
Rich Scheuermann
Hi,
You can define a filter field in the table description.
I believe that with the ..Filter attribute of the table you can assign the filter value and refresh the table with TableDisplay(TableName, taInit).
Cheers,
Peter
Posté le 02 octobre 2005 - 00:28
G'day Rich
I don't use autofilled combo boxes and queries so I may be wrong here but :
Your filter on the contacts table is based on the value in the OrgConts file but the value returned in the combo box is in the query, the file record pointer could be pointing anywhere and when you run the contacts table init again it reverts back to the file pointer and not the ArchitectId in the query. Shouldn't the filter refer to the query value not the file value.
I always hand code these sort of things, so I would fill the combo field with a glink() value of the ArchitectId and on selection - not exit - hreadnext() on a filtered view of the contacts to fill contacts table in a loop.
I know thats the oldfashioned way but it always works. - (need a graphic of programmer with head buried in the sand but caveman is close enough)
Regards
Al