lulazz
Posts: 29
|
| Posted: 03/10/2008, 8:16 AM |
|
Hi,
I need to build a report based on date period and 1 parameter.
if this paremeter is 0 the data I need to filter is on 1 table
if the parameter is 1 the data is on another table.
Is there a way of telling CCS to execute query0 if parameter is 0 or query1 if parameter is 1?
eg.
this is the select if type=0
SELECT distinct
pazienti.cartella ,
a_pazienti.nominativo as paziente ,
proroghe.scadenza,
pazienti.reparto
FROM
s_pazienti ,
a_pazienti ,
pazienti,
proroghe
WHERE
( proroghe.paziente = pazienti.seriale ) and
( pazienti.seriale = s_pazienti.codice ) and
( a_pazienti.seriale = pazienti.codice ) and
(proroghe.scadenza between '[data1]' and '[data2]' and
pazienti.tipo ='[type]'
and this one if type=1
SELECT distinct
pazienti.cartella ,
a_pazienti.nominativo as paziente ,
piani_cura.fine,
pazienti.reparto
FROM
s_pazienti ,
a_pazienti ,
pazienti,
piani_cura
WHERE
( proroghe.paziente = pazienti.seriale ) and
( pazienti.seriale = s_pazienti.codice ) and
( a_pazienti.seriale = pazienti.codice ) and
(piani_curaa.fine between '[data1]' and '[data2]' and
pazienti.tipo ='[type]'
where [data1][data2] and [type] are the parameters
the 2 tables that hold the data I need to filter are proroghe and piani_cura
Thanks
Lulazz
|
 |
 |
DonP
|
| Posted: 03/10/2008, 8:25 AM |
|
Using a Before Build Select event, you can make a query on 0 but the
query value will probably need to be in quotes. Otherwise it will also
find NULL values which might not be what you want.
Don (DonP)
lulazz wrote:
> Hi,
> I need to build a report based on date period and 1 parameter.
> if this paremeter is 0 the data I need to filter is on 1 table
> if the parameter is 1 the data is on another table.
> Is there a way of telling CCS to execute query0 if parameter is 0 or query1 if
> parameter is 1?
>
>
>
> eg.
> this is the select if type=0
>
> SELECT distinct
> pazienti.cartella ,
> a_pazienti.nominativo as paziente ,
> proroghe.scadenza,
> pazienti.reparto
> FROM
> s_pazienti ,
> a_pazienti ,
> pazienti,
> proroghe
> WHERE
> ( proroghe.paziente = pazienti.seriale ) and
> ( pazienti.seriale = s_pazienti.codice ) and
> ( a_pazienti.seriale = pazienti.codice ) and
> (proroghe.scadenza between '[data1]' and '[data2]' and
> pazienti.tipo ='[type]'
>
> and this one if type=1
>
> SELECT distinct
> pazienti.cartella ,
> a_pazienti.nominativo as paziente ,
> piani_cura.fine,
> pazienti.reparto
> FROM
> s_pazienti ,
> a_pazienti ,
> pazienti,
> piani_cura
> WHERE
> ( proroghe.paziente = pazienti.seriale ) and
> ( pazienti.seriale = s_pazienti.codice ) and
> ( a_pazienti.seriale = pazienti.codice ) and
> (piani_curaa.fine between '[data1]' and '[data2]' and
> pazienti.tipo ='[type]'
>
> where [data1][data2] and [type] are the parameters
>
> the 2 tables that hold the data I need to filter are proroghe and piani_cura
>
> Thanks
> Lulazz
>
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
|