Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
5
Erster Beitrag:
vor 2 Jahren, 10 Monaten
Letzter Beitrag:
vor 2 Jahren, 10 Monaten
Beteiligte Autoren:
Mark P, DerekT, Allard

New user question on Combos & tables

Startbeitrag von Mark P am 07.10.2015 02:15

Hello all,

I am using the Express version to get a taste of WinDev and want to get an idea on how to:

- change the contents of a table based on a selection made in a combo box (both in same window).

The combo box reads from a file called events. The file contains an EventId and a Name.
The table reads from a file called EventLocations and contains fields called EventId, LocationID, and Location.
I want the table to show only those locations that have the same EventId as selected in the Combobox.

I am lost ... I am very familiar with Clarion, but cannot figure it out in WinDev.

Also are the printed manuals more descriptive for people needing a jumpstart? I thumbed through the tutorial examples and printed matter and don't see much written on this topic and I imagine a bunch of others.

Antworten:

Re: New user question on Combos & tables

Mark
How are you filling the table?

If you are data binding directly to the EventsLocation file then check out HFilter and ..Filter in the help.

My preferred method is to use a query to fill the table then in the combo 'on selection'
Set the query param - MyQuery.param = idfrom combo followed by TableDisplay(MyTable,taReExecuteQuery)

von DerekT - am 07.10.2015 10:05

Re: New user question on Combos & tables

I was filling by the table, but am now trying the way you are suggesting. Do I need to create a variable called param, or do I refer to the name of the field in the query I want to compare to? i.e.

MyQuery.param = idfrom combo becomes ...

MyQuery.Location.EventID= Combobox

where combo box returns the value Events.EventID

von Mark P - am 09.10.2015 02:45

Re: New user question on Combos & tables

Hi

MyQuery.Location.EventID= Combobox

In the combo box you can set what it returns ( 7 tab s)

For this kind of thing I use "internal queries" for the table. In the ini code of the table you can then place the code of the querie

mysource.parameter = combo

In the combo you can then put code to refresh the table:

tabledisplay( tablename, tainit) The tainit will run the initiation of the table


regards

Allard

von Allard - am 09.10.2015 08:27

Re: New user question on Combos & tables

Mark
On the assumption you have 2 queries.
1. qryListEvents - for the combo
2. qryLocationByEventID - for the table, this will expect the parameter pnEventID.

Bind the combo to the qryListEvents, in the Description\Content tab set the 'Stored item:' to the EventID.

You will find that WD usually offers a number of ways to achieve a result so you do have options.

You can declare a variable (in the global declarations of the window) say 'wnEventID is int'
In the Description\Link tab select this from the Variables\SimpleTypes

In the 'Selecting a row' code block of the combo you can then use this variable
qryLocationByEventID.pnEventID = wnEventID
TableDisplay(EventLocations,taReExecuteQuery)

If you have not used a global variable then
qryLocationByEventID.pnEventID = MySelf will suffice to set the parameter.

You may of course place this code in a local procedure say 'lpEventOnSelect' called from the 'Selecting a row' code block
In this case then MySelf will not operate correctly so you need
qryLocationByEventID.pnEventID = cmbEvents or (belt and braces) qryLocationByEventID.pnEventID = cmbEvents..StoredItem

HTH

von DerekT - am 09.10.2015 08:39
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.