Icon View Thread

The following is the text of the current message along with any replies.
Messages 11 to 20 of 22 total
Thread SQL / Parameter question
Tue, Mar 28 2006 1:11 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Connie,

<< The process is that the user is prompted for the parameters.  The results
are placed in a list, in the form of pname=pvalue;pdatatype.
This code goes through the list, and replaces the parameters. And, BTW, This
is happening for all of the previous queries.  >>

I'm afraid that your generic procedure doesn't tell me much since I don't
know what is being passed into this procedure.  Could you give me an example
that shows the inputs to the procedure ?

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Mar 28 2006 4:42 PMPermanent Link

Connie McBride
'StartDate=2005-03-28;Date'
'EndDate=2006-03-28;Date'
'RecordUID= ;String'
'Closed=True;Boolean'

"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote:

Connie,

<< The process is that the user is prompted for the parameters.  The results
are placed in a list, in the form of pname=pvalue;pdatatype.
This code goes through the list, and replaces the parameters. And, BTW, This
is happening for all of the previous queries.  >>

I'm afraid that your generic procedure doesn't tell me much since I don't
know what is being passed into this procedure.  Could you give me an example
that shows the inputs to the procedure ?

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Mar 28 2006 4:53 PMPermanent Link

Connie McBride
Using this query
Select I.*
from Invoice I
where
( (:StartDate is null) or ( I.InvoiceDate >= :StartDate)) and        
((:EndDate is null) or( I.InvoiceDate <= :EndDate)) and
 ((:RecordUID is null) or (I.CustUID = :RecordUID) or (I.UID = :RecordUID)) and
( (:Closed is null) or (I.Closed = :Closed))

Order by I.BillName, I.CustName, I.InvoiceDate

and these parameters:
'StartDate=2005-03-28;Date'
'EndDate=2006-03-28;Date'
'RecordUID= ;String'
'Closed=True;Boolean'

I get 0 records
Add the 'isorder' statement and I get 254 records.

If I remove the 'recordUID' condition (the parameter is blank), I get no change.
Wed, Mar 29 2006 2:55 AMPermanent Link

Chris Erdal
Connie McBride <conniem@axcis.net> wrote in
news:FC090D6C-6101-404E-8441-FC2216D459A1@news.elevatesoft.com:

> Using this query
> Select I.*
> from Invoice I
> where
>  ( (:StartDate is null) or ( I.InvoiceDate >= :StartDate)) and        
>  ((:EndDate is null) or( I.InvoiceDate <= :EndDate)) and
>   ((:RecordUID is null) or (I.CustUID = :RecordUID) or (I.UID =
>   :RecordUID)) and
>  ( (:Closed is null) or (I.Closed = :Closed))
>
> Order by I.BillName, I.CustName, I.InvoiceDate
>
> and these parameters:
> 'StartDate=2005-03-28;Date'
> 'EndDate=2006-03-28;Date'
> 'RecordUID= ;String'
> 'Closed=True;Boolean'
>
> I get 0 records
> Add the 'isorder' statement and I get 254 records.
>

do you mean adding

(1)  I.IsFromOrder = false and

or adding

(2)   (I.IsFromOrder = false or I.IsFromOrder = true) and  

?

If (1) then we're back to my initial hypothesis of Isorder being equal to

(false and <all the rest which was already false for some strange
reason>)

i.e. AND takes priority over = , which is not very intuitive IMHO.

If (2) then I'm lost for an explanation - sorry.

I would have suggested testing the date values against zero as well, i.e.
1899-12-31 if my memory is correct, but since the correct rows are
returned by the query with the dummy test, this probably wouldn't be
relevant.

One more possibility: is InvoiceDate a DateTime value? Does it include
the time part? If so you should never get any rows corresponding to the
"EndDate" as InvoiceDate is always greater than 00:00h on the specified
date. Leaving EndDate empty should therefore work if you want all rows up
to now.
--
Chris
Wed, Mar 29 2006 2:58 AMPermanent Link

Chris Erdal
Chris Erdal <chris@No-Spam-erdal.net> wrote in
news:Xns97956488D539014torcatis@64.65.248.118:

> Leaving EndDate empty should therefore work if you
> want all rows up to now.

Sorry, I mis-read EndDate as being equal to StartDate, not one year
later...

--
Chris
Wed, Mar 29 2006 12:28 PMPermanent Link

Connie McBride
Chris Erdal <chris@No-Spam-erdal.net> wrote:

I meant:
(2)   (I.IsFromOrder = false or I.IsFromOrder = true) and  

?

If (2) then I'm lost for an explanation - sorry.


One more possibility: is InvoiceDate a DateTime value? Does it include
No
Wed, Mar 29 2006 4:47 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Connie,

<< 'StartDate=2005-03-28;Date'
'EndDate=2006-03-28;Date'
'RecordUID= ;String'
'Closed=True;Boolean' >>

I've attached what I tried here, and it seems to work just fine, so I'm
going to need to see the tables that you're using to try and find out what
is going on.  I can't seem to recreate anything here based upon what you've
given me so far.

--
Tim Young
Elevate Software
www.elevatesoft.com





Attachments: parseparams.zip
Wed, Mar 29 2006 9:33 PMPermanent Link

Connie McBride
"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote:

Connie,

I've attached what I tried here, and it seems to work just fine, so I'm
going to need to see the tables that you're using to try and find out what
is going on.  I can't seem to recreate anything here based upon what you've
given me so far.


Tried with your table (it worked).
Replaced with my table (it doesn't work - returns 0 records)
Attached is my table.



Attachments: Invoices.zip
Thu, Mar 30 2006 4:47 AMPermanent Link

Chris Erdal
Connie McBride <conniem@axcis.net> wrote in
news:7C295728-09DC-4BB1-A85E-6C64A386BBF2@news.elevatesoft.com:

> Attached is my table.

Connie,

 I've tried a little test program (attached) on your table, and it seems
to work with your SQL:

Select I.*
from Invoice I
where
 (:StartDate is null or  I.InvoiceDate >= :StartDate) and     
 (:EndDate is null or I.InvoiceDate <= :EndDate) and
 (:RecordUID is null or (I.CustUID = :RecordUID or I.UID = :RecordUID))
and
 (:Closed is null or I.Closed = :Closed)

--
Chris
Thu, Mar 30 2006 4:47 AMPermanent Link

Chris Erdal

=ybegin line=128 size=2143 name=TestParams.zip
zu-=n>*,*2*↨^fKL=n**;**3***[XDc>)=I2k*-tZ@^]I`6ۻ($43fi`e3N LXi(VO
dYFʦ-k3k=@C |>DMX>Up *]N=nQ9])% w&|b%ܺ'Tvj)߱f<;k2 %6֣>䬊
sLN4qMwlu$Lc=@1\],v<H'=}NY˥<Oanv* ԆSfd PKt27|;=}[~>=Ia,=@\gFGΟ_6~l4
CbyllC=n;=I=@Hc=@BR a,Ir䶤{Ƣ?o^=MEq=n7UԞ W? {=nxQy+A3>K*Y2
>6kB@MXOi=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