1

I am hoping someone will be able to point me in the right direction. I have a Looper control within WinDev and am filling the Content using a Query.

How do I utilise a global variable within the query? It seems that it must be passed in as a parameter to the query, however there is no opportunity to set the parameter unless executing the query from code. It all seems a little contradictory and I am sure I'm missing something obvious.

UPDATE

Having read about MySource but also read that MySource cannot be utilised in an Initialization block; I have moved the query to independent. Thereby allowing me to set the parameter with

Query name.Parameter = Value

However, although the Query is specified in the Content table of the Looper control, it does not seem to return anything.

Have tried calling HExecuteQuery() and LooperDisplay(), neither of which seem to do anything.

The query is a simple select and works when tested in the query editor.

Any help would be greatly appreciated,

Roddy
  • 2,018
  • 3
  • 16
  • 21
  • Can you show your code or your are using the request builder ? – kranteg Jun 23 '14 at 12:24
  • I have created a simple query (have now moved it from embedded to independent). The query has a parameter which I have tried setting in the initialisation of the Window and in the initialisation of the Looper; neither of which work. I have tested the query with the value being passed and it works. I have put a breakpoint in the code to ensure the correct value is being passed in. I have tried calling HExecuteQuery() after setting the parameter and LooperDisplay(); neither of which change anything. – Roddy Jun 29 '14 at 03:06

2 Answers2

2

It turns out that I had to go into the Description of each field and re-click the Link entry. Nothing changed as I clicked them but the data now appears.

Not a great solution but it resolved the issue :-(

Roddy
  • 2,018
  • 3
  • 16
  • 21
1

Changing from embedded to independent is the best thing you could do and it's the best practice as well. Once the source has changed though you do have to rebind all the data to the attributes since it loses it's references.

You better execute the query at the window's Global Declarations section if you don't want to eat up resources and I/Os for nothing by using the Window's End of Initialization section like I've seen people doing .

This way you don't need to call LooperDisplay() and your independent Query will only be called once by your HExecuteQuery().