anant desai
14th June 2012, 06:59
I have a problem as follows:

Select tdsls040.*
from tdsls040
where tdsls040.odat inrange {:stdt} and {:endt}
stdt = date.num()
endt = stdt - days.diff
where days.diff is a form field.
where stdt and endt are of domain tcdate.

This statement gives a compile error.
What could be the problem?

JaapJD
14th June 2012, 09:48
Try code as followis:

stdt = date.num()
endt = stdt - days.diff

select tdsls040.*
from tdsls040
where tdsls040.odat inrange {:stdt} and {:endt}
selectdo
... do what you want here
endselect

But this query will not return any rows if days.diff > 0 !!! Probably you should add days.diff to stdt to get the proper endt.

anant desai
15th June 2012, 05:01
What I want to achieve functionally is to find
all Sales Orders entered in the last days.diff days.

JaapJD
15th June 2012, 08:31
Seems to me that you have to switch stdt and endt then.

Raveendranath
16th June 2012, 06:33
do not use braces {}
instead write
where tdsls040.odat inrange :stdt and :endt

bdittmar
16th June 2012, 21:46
What I want to achieve functionally is to find
all Sales Orders entered in the last days.diff days.

Hello,
your requirement is, to select the orders in the last diff.days.


---------------|------------|
diffdays ^TODAY


So enddate is date.num() = today
and startdate is date.num() - diffdays


stdt = date.num() - days.diff
endt = date.num()

select tdsls040.*
from tdsls040
where tdsls040.odat inrange {:stdt} and {:endt}
selectdo
... do what you want here
endselect

or

select tdsls040.*
from tdsls040
where tdsls040.odat >= :stdt
and tdsls040.odat <= :endt
selectdo
... do what you want here
endselect




PS: Use the proper forum in tools, please.
Maybe a moderator is able to move this post.

Regards