Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 6 Jahren, 4 Monaten
Letzter Beitrag:
vor 6 Jahren, 4 Monaten
Beteiligte Autoren:
Al , Piet van Zanten, DarrenF

[WD16] Multi file links from a query table not working

Startbeitrag von Al am 06.02.2012 03:52

Hello All

I have a table where the data is supplied from a query - not an embedded query. The query is the "Browsed File" in the content section of the table editor. When I try to link a table column to a single or multi file using the Link section of the table editor, the options for single and multi file links are greyed out. Is this correct or have I set up the table wrongly ?



Hi Al,

That's my experience too.
If have no idea why this has not been implemented yet by PCsoft.
The only workarounds I know of are to use a combo column or programming.
Of course you could create a query on the main query to include the lookup items, but then the query would no longer be modifiable.
Request for new features:
- Possibility to define the main file in a multifile query to be able to make it modifiable.
- Make the multifile link option also available for queries.


von Piet van Zanten - am 06.02.2012 09:13
Hello Piet

Thanks for the confirmation. I haven't had much to do with query driven tables so I wasn't sure if I had left something out.

It doesn't make any sense for PCSoft to provide really good and simple ways to push the data from queries into tables and then leave them high and dry in terms of linking to associated data.

In my case I will now have to read through the query in a loop, collect the link info and use tableadd() to fill in the table rows - definitely not 10 times faster! in terms of code or performance.


von Al - am 06.02.2012 10:48
Al /Piet,

Yes, as far as I understand it, using a Query overrides the "Link" functionality.

This issue also raises a good point...

Up until now, I've been avoiding Queries (embedded or otherwise), for populating Table controls for a similar reason - you loose the "Multi-file" capability. At the moment I'm using a combination of off-screen Table controls linked to my on-screen Table control, HFilter and the Multi-file feature.

Having said this, so far I've not needed to use Queries, as the Multi-file capability is quite powerful. My main concern with using HFilter and Multi-file are the potential performance implications as my customers' data grows? :eek:

von DarrenF - am 06.02.2012 11:48
Hi Al,

I understand you are making the switch to queries.
Some query-driven alternatives to your above solution:

  • Create a query on the main query, adding the linked file items and link the table to this new query. (Or create an entirely new query with all the necessary items)
  • Do a query on the entire linked file and do a hReadSeek in the row display code of the table and some code to fill the linked columns. This is faster, because the query result will be in memory and hReadSeek will be faster.
  • create a combo column for the linked data and fill the combo based on a query.
To limit the number of predefined queries I'm using more and more queries with hExecuteSQLquery and the data source variable. I build the (more complex) queries with the query editor and then copy the SQL code to the text variable. I found the square bracket syntax to assign multi line text to a variable to be very convenient for this:
ds_MySource is data source
MyFile.Code AS Code,
MyFile.Date AS Date
MyFile.Amount AS Amount
MyFile.Code = '%1'
AND MyFile.Date >='%2'
Date ASC
After that I delete the predefined query from the project.
You can do a hReadseekFirst on ds_MySource too. And use the file items by programming: col_Date=ds_MySource.Date


von Piet van Zanten - am 06.02.2012 12:02
Hi Al and Darren,

Probably the reason why PCsoft did not include the link feature for queries is the nature of queries itself.
Why use an extra external link if you can include the linked files in the query?
That's what queries are made for, it's faster and more convenient.

The only drawback for the multifile query approach is that the query is not modifiable.
And that's only for editable tables, for tables with forms you can do a search and link the form to the file directly.


von Piet van Zanten - am 06.02.2012 12:15
Hello Piet

I can see the sense of the methods you outline - thanks you for sharing your expertise.
I don't think I can fill a query with the all data I need because I fear it will be quite complex and I don't have enough experience with queries to write them. For the table in question, I have to retrieve 8 items from other files using single foreign key links and two items using a double link. This is however quite straightforward running through the query in a loop and using hreadseek() to retrieve the data from views that are already in memory.
and I will try your idea using the row display.

Hello Darren

I am switching to queries to make best use of the ClientServer and I am having to switch to that because it is supposed to be multi threaded and will run quicker on current servers with slow clock speed but multiple cores.


von Al - am 06.02.2012 12:50
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.