Skip to Content
author's profile photo Former Member
Former Member

Add command parameter(Sugesstion needed)

Hi ALl,

i am using Oracle crystal reports 2008

I am writing a add command this is my query.

select r.task_id, r.text_value as result, s.timestamp,r.task_id,s.sample_id, r.units, r.condition,r.status ,r.component,a.text_value,a.name, s.user_sampleid,ns.study from naiv_sample_attributes a inner join nai_samples s

on s.sample_id=a.sample_id

inner join nai_results r on s.sample_id=r.sample_id

inner join nai_submissions ns on

ns.submission_id=s.submission_id

where

a.name='Date Received' and

to_date(a.text_value,'DD-MON-yyyy HH24:mi:ss') between

to_date('1-APR-2013 18:52:22','DD-MON-yyyy HH24:mi:ss')

and to_date('30-APR-2013 18:52:22','DD-MON-yyyy HH24:mi:ss')

and

r.status =

CASE

WHEN r.status ='{parameter1}' THEN 'COMPLETE'

END

and

r.condition=

CASE

WHEN r.condition='{parameter2}' THEN 'APPROVED' & 'ONLINE'

END

My question is my parameter 1 contains ' COMPLETE/SUSPECT' , COMPLETE, SUSPECT so if i enter parameter as COMPLETE/SUSPECT it should select all values in r.status as COMPLETE and SUSPECT as there is no COMPLETE/ SUSPECT in our DB . its equivalent selection formula is

as r.status in (COMPLETE, SUSPECT). So how can i achieve this using SQl (add command ) it dnt want it do this using seelction forumla.

Should i use case stament or decode or something else please suggest

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Jan 09, 2014 at 06:40 PM

    I would take out the case statement & do something like this:

    (

    ('{parameter1}' = 'COMPLETE/SUSPECT' and r.status in ('COMPLETE', 'SUSPECT')) or

    r.status = '{parameter1}'

    )

    Note where the parentheses are - they're important for getting this to work correctly.

    -Dell


    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      I understand this logic thank u

      but i am getting a error missing right parenthesis and i have checked the whole query there is no parenthesis missing

      select r.task_id, r.text_value as result, s.timestamp,r.task_id,s.sample_id, r.units, r.condition,r.status ,r.component,a.text_value,a.name, s.user_sampleid,ns.study from naiv_sample_attributes a inner join nai_samples s

      on s.sample_id=a.sample_id

      inner join nai_results r on s.sample_id=r.sample_id

      inner join nai_submissions ns on

      ns.submission_id=s.submission_id

      where

      a.name='Date Received' and

      to_date(a.text_value,'DD-MON-yyyy HH24:mi:ss') between

      to_date('{?Start Date}','DD-MON-yyyy HH24:mi:ss')

      and to_date('{?End Date}','DD-MON-yyyy HH24:mi:ss')

      -- and a.text_value between '{?Start Date}' and '{?End Date}'

      and ns.Study like '{?Study}'

      and s.user_sampleid like '{?User Sample ID}'

      and

      r.status=(

      ('{?Result Status}'=('COMPLETE/SUSPECT') and r.status in ('COMPLETE', 'SUSPECT')) or

      r.status ='{?Result Status}'

      )

  • Posted on Jan 09, 2014 at 07:02 PM

    Hi Venkatesh,

    Please do Not create multiple threads for the same issue.

    Continue the discussion in this thread.

    -Abhilash

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.