How to pass parametar to some View
Hi!
I have tried to execute some queris which should rely in search criteria
based on some count values. Example (look at "COUNT_2" value):
SELECT Odjel.Naziv, Skola.Naziv AS Naziv_3,
Kategorija.Naziv AS Naziv_2, UMV.Prosao,
UMV.Poz, COUNT(*) AS COUNT_2
FROM ((((UMVGL UMVGL INNER JOIN UMV UMV ON
(UMV.Sifra = UMVGL.Sifra) )
INNER JOIN Kategorija Kategorija ON
(Kategorija.Sifra = UMV.Kategorija) )
INNER JOIN Skola Skola ON
(Skola.Sifra = UMVGL.Skola) )
INNER JOIN Odjel Odjel ON
(Odjel.Sifra = Skola.Odjel) )
WHERE ( UMVGL.Datum >= #2003-01-01# )
AND ( UMVGL.Datum <= #2003-10-01# )
AND ( UMVGL.Storno = FALSE )
AND ( COUNT_2 >= 100 )
GROUP BY Odjel.Naziv, Skola.Naziv,
Kategorija.Naziv, UMV.Prosao, UMV.Poz
ORDER BY Odjel.Naziv, Skola.Naziv,
Kategorija.Naziv)
I know that this is not regular SQL but if I do sql like:
SELECT Odjel.Naziv, Skola.Naziv AS Naziv_3,
Kategorija.Naziv AS Naziv_2, UMV.Prosao,
UMV.Poz, COUNT(*) AS COUNT_2
FROM ((((UMVGL UMVGL INNER JOIN UMV UMV ON
(UMV.Sifra = UMVGL.Sifra) )
INNER JOIN Kategorija Kategorija ON
(Kategorija.Sifra = UMV.Kategorija) )
INNER JOIN Skola Skola ON
(Skola.Sifra = UMVGL.Skola) )
INNER JOIN Odjel Odjel ON
(Odjel.Sifra = Skola.Odjel) )
WHERE ( UMVGL.Datum >= #2003-01-01# )
AND ( UMVGL.Datum <= #2003-10-01# )
AND ( UMVGL.Storno = FALSE )
GROUP BY Odjel.Naziv, Skola.Naziv,
Kategorija.Naziv, UMV.Prosao, UMV.Poz
ORDER BY Odjel.Naziv, Skola.Naziv,
Kategorija.Naziv)
which I call ViewDemo then with query (look at count_2 AGAIN:)
SELECT * from ViewDemo
where count_2>10
So, I could get some more filtered data.
My question is: how to pass some values as parameter to some query?
Thx!
Benjamin
I have tried to execute some queris which should rely in search criteria
based on some count values. Example (look at "COUNT_2" value):
SELECT Odjel.Naziv, Skola.Naziv AS Naziv_3,
Kategorija.Naziv AS Naziv_2, UMV.Prosao,
UMV.Poz, COUNT(*) AS COUNT_2
FROM ((((UMVGL UMVGL INNER JOIN UMV UMV ON
(UMV.Sifra = UMVGL.Sifra) )
INNER JOIN Kategorija Kategorija ON
(Kategorija.Sifra = UMV.Kategorija) )
INNER JOIN Skola Skola ON
(Skola.Sifra = UMVGL.Skola) )
INNER JOIN Odjel Odjel ON
(Odjel.Sifra = Skola.Odjel) )
WHERE ( UMVGL.Datum >= #2003-01-01# )
AND ( UMVGL.Datum <= #2003-10-01# )
AND ( UMVGL.Storno = FALSE )
AND ( COUNT_2 >= 100 )
GROUP BY Odjel.Naziv, Skola.Naziv,
Kategorija.Naziv, UMV.Prosao, UMV.Poz
ORDER BY Odjel.Naziv, Skola.Naziv,
Kategorija.Naziv)
I know that this is not regular SQL but if I do sql like:
SELECT Odjel.Naziv, Skola.Naziv AS Naziv_3,
Kategorija.Naziv AS Naziv_2, UMV.Prosao,
UMV.Poz, COUNT(*) AS COUNT_2
FROM ((((UMVGL UMVGL INNER JOIN UMV UMV ON
(UMV.Sifra = UMVGL.Sifra) )
INNER JOIN Kategorija Kategorija ON
(Kategorija.Sifra = UMV.Kategorija) )
INNER JOIN Skola Skola ON
(Skola.Sifra = UMVGL.Skola) )
INNER JOIN Odjel Odjel ON
(Odjel.Sifra = Skola.Odjel) )
WHERE ( UMVGL.Datum >= #2003-01-01# )
AND ( UMVGL.Datum <= #2003-10-01# )
AND ( UMVGL.Storno = FALSE )
GROUP BY Odjel.Naziv, Skola.Naziv,
Kategorija.Naziv, UMV.Prosao, UMV.Poz
ORDER BY Odjel.Naziv, Skola.Naziv,
Kategorija.Naziv)
which I call ViewDemo then with query (look at count_2 AGAIN:)
SELECT * from ViewDemo
where count_2>10
So, I could get some more filtered data.
My question is: how to pass some values as parameter to some query?
Thx!
Benjamin
This discussion has been closed.
Comments
The following example shows how to extract the TdaSQL object associated with
a QueryDataView and modify the SQLText. The example creates
Report.AutoSearchFields[] and then applies the values entered by the user to
the SQLText.
http://www.digital-metaphors.com/tips/ExtractEditAsTextSQLObject.zip
--
Nard Moseley
Digital Metaphors
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
can not make it work. If you could make a small demo (with example from
Northwind dtabase taht come with office and some crosstab query that is used
there).
THX
Benjamin
How about you create a simple demo usingn Northwinds. Try to code it as
shown in the example. If you cannot get it to work, then send in .zip format
to support@digital-metaphors.com and we can check it out.
--
Nard Moseley
Digital Metaphors
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
THX!
Please send the example again, we have not received it. When we receive it
we will respond that it has been received.
--
Nard Moseley
Digital Metaphors
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com