Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2nd parameter to look at 1st parameter

Status
Not open for further replies.

sbcsandhu

Programmer
Jul 3, 2007
113
US
is there a way to do this

i have my first parameter transaction successful
which is Y/N

then my second and third is begin date and end date

if they choose Y then they can do a 6 month begin date and end date range

if they choose N then they can do a 1 year begin date and end date range.

is this possible?

thanks
 
I would just use the begin date parameter to do this, as in:

(
(
{?trans} = 'Y' and
{table.date} in {?begin} to dateadd("m",6,{?begin})-1
) or
(
{?trans} = 'N' and
{table.date} in {?begin} to dateadd("m",12,{?begin})-1
)
)

-LB
 
well it really doesnt matter what the begin date is
if a person enters 'y'
i dont want the end date to go past 6 months

would u still use the begin date?
if so can u explain why
 
I guess you mean 6 months from now.

(
(
{?trans} = 'Y' and
{table.date} in currentdate to dateadd("m",6,currentdate)-1
) or
(
{?trans} = 'N' and
{table.date} in currentdate to dateadd("m",12,currentdate)-1
)
)

-LB
 
lbass, sorry but i never done this in a query before

where and how would i implement this in my query

select main.rec_no as rec_no_Main,
main.user_id as User_id_Main,
main.User_last_name as User_last_name_main,
main.User_first_name as User_first_name_main,
main.User_middle_initial as User_middle_initial_main,
main.action_date as action_date_main,
main.Action_time as action_time_main,
main.Window_title as window_title_main,
main.Trans_id as Trans_id_main,
main.key_name as Key_Name_main,
main.key_value as key_value_main,
main.action_type as action_type_main,
main.workstation_id as workstation_id_main,
main.trans_succ as trans_succ_main,
main.review_status as review_status_main,
main.inq_sw as inq_sw_main,
(select [attribute name]
from mrextract.dbo.t_code code
where code.[tag id] = mod.col_name) as attribute_name,
mod.*
from mrextract.dbo.MR0052E_MAIN main
inner join mrextract.dbo.MR0052E_MOD mod on main.rec_no = mod.rec_no
where

(
(
'{?User_ID}' <> 'ALL' and
main.user_id = '{?User_ID}'
) or
'{?User_ID}' = 'ALL'
) and
( main.action_date > = {?Action Date Start}
and main.action_date <= {?Action Date End})

and
(
(
'{?Transaction Sucessful}' <> 'ALL' and
main.trans_succ = '{?Transaction Sucessful}'
) or
'{?Transaction Sucessful}' = 'ALL'
)

and
(
(
'{?Action Type}' <> 'ALL' and
main.action_type = '{?Action Type}'
) or
'{?Action Type}' = 'ALL'
)


 
lbass, sorry but i never done this in a query before

where and how would i implement this in my query
 
You should have explained in your opening post that you were trying to write a query for a command. I'm assuming from your other post that you were able to find out the correct syntax/functions to use in the command in order to accomplish this.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top