PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Query with Subquery /w Parameter
Query with Subquery /w Parameter
Débuté par Andreas Dolleschal, 08 nov. 2007 16:53 - 3 réponses
Posté le 08 novembre 2007 - 16:53
Hello,

I have defined a query (QRY_A) which using a Subquery (QRY_B) for a specific Field (defined as parameter FIELD_A). The Subquery also has a parameter (FIELD_B) which will be filled by a field on my window.

It seems that the Parameter for the Subquery is ignored if I'm setting the Parameter for the Query (i guess the reason is because the query will be called internal).

I'm using the following code:

QRY_B.FIELD_B = "TEST"

HExecuteQuery(QRY_A)

Doing it this way does not work. Is there any other way the define the Parameter FIELD_B for QRY_A?

Thanks a lot.

Best regards

Andreas
Posté le 08 novembre 2007 - 18:13
...

>I'm using the following code:

QRY_B.FIELD_B = "TEST"


>HExecuteQuery(QRY_A)

Doing it this way does not work. Is there any other way the define the Parameter FIELD_B for QRY_A?


...

Hi,

unless there is something I don't understand properly, above you are setting the parameter of query_B not Query_A...

Regards

mat
Posté le 08 novembre 2007 - 18:33
>...

I'm using the following code:


>>QRY_B.FIELD_B = "TEST"

HExecuteQuery(QRY_A)


>>Doing it this way does not work. Is there any other way the define the Parameter FIELD_B for QRY_A?

...


>Hi,

unless there is something I don't understand properly, above you are setting the parameter of query_B not Query_A...


>Regards

mat


Hi mat,

You are right. Thats because FIELD_B is the Parameter for the Subquery. This Parameter is not visible in QRY_A because it's a parameter of QRY_B :(

I did it now by not using the Subquery, i'm calling QRY_B directly and parse the results into the Parameter of the Main-Query, this works. I assumed it would be easier with an subquery.

Best regards

Andreas
Membre enregistré
1 message
Posté le 06 août 2018 - 11:50
Hello,

I got this working this way:

QRY_B.param1 = value1
QRY_B.param2 = value2
if HExecuteQuery( QRY_B ) then
if HExecuteQuery(QRY_A,hquerydefault,value1,value2) then
for each QRY_A
tabledisplay(TableA, <fields of QRY_A)
end
end
end

Param1 and Param2 are not defined in QRY_A, but still I'm able (and even required) to add them in HExecuteQuery

I hope this helps...

Wim
Message modifié, 06 août 2018 - 11:50