index | search | no replies | posting guidelines | help login | register
Index » Products » ASP Report Wizard v2
search this forum:
:: How do I do # of days in stock? :: (8)Post a New Message | Post a Reply
Mar 18 2005, 4:15 PM
 How do I do # of days in stock?Post a Reply
 digitald2

View this author's profile Send this author a private message

since: Feb 21, 2005
from: Hawaii

If I have a field that has the date received.  How can I have another field that displays the days in stock.  I would assume you need to somehow tell it current date minus the date received.

Mar 22 2005, 12:48 PM
 Re: How do I do # of days in stock?Post a Reply
 ghost

View this author's profile Send this author a private message Visit author's homepage

from: Washington, DC

I keep having javascript errors. I will see if this functionality can be added


-------------------------
Ghost
May 17 2005, 6:35 AM
 Re: How do I do # of days in stock?Post a Reply
 ghost

View this author's profile Send this author a private message Visit author's homepage

from: Washington, DC

If you have a field named e.g. DateReceived you can do the number of days in stock with the TextReplacement as follows:

Enter this for your TextReplacement

"var date1 = new Date();var date2 = new Date('{{DateReceived}}');parseInt((date1.valueOf()-date2.valueOf())/(24*60*60*1000));"




-------------------------
Ghost
Jun 24 2005, 4:02 PM
 Re: How do I do # of days in stock?Post a Reply
 digitald2

View this author's profile Send this author a private message

since: Feb 21, 2005
from: Hawaii

It doesn't work!
I need to put that in between the  [sql]    and  [/sql] right?

Jun 24 2005, 4:10 PM
 Re: How do I do # of days in stock?Post a Reply
 digitald2

View this author's profile Send this author a private message

since: Feb 21, 2005
from: Hawaii

It prints:

[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 'Date'.

even if I just type:    [sql] new date() [/sql]

if I just use:  [sql] date() [/sql]

it returns: [Microsoft][ODBC SQL Server Driver][SQL Server]'date' is not a recognized function name



Jun 25 2005, 5:44 AM
 Re: How do I do # of days in stock?Post a Reply
 ghost

View this author's profile Send this author a private message Visit author's homepage

from: Washington, DC

DATE IS NOT a SQL Server function.

The SQL Server function you want is GETDATE()

e.g. [sql]GETDATE()[/sql] will return the current date

All statements within the [sql] tags MUST BE VALID statements for the database you are using. e.g. NOW for Access, GETDATE for SQL server etc.


-------------------------
Ghost
Jun 27 2005, 3:27 PM
 Re: How do I do # of days in stock?Post a Reply
 digitald2

View this author's profile Send this author a private message

since: Feb 21, 2005
from: Hawaii

I am trying to get # of days in stock for cars.  I have a field called “DateReceive” and I am using a Microsoft SQL database.


I tried using

[sql] (CAST(GETDATE()-DateReceive) AS int)/(24*60*60*1000) [/sql]

But I get this error:

[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near 'CAST', expected 'AS'.


Jun 28 2005, 4:55 AM
 Re: How do I do # of days in stock?Post a Reply
 ghost

View this author's profile Send this author a private message Visit author's homepage

from: Washington, DC

In order to get the number of days in SQL Server, you need to use the DateDiff function as shown below:

[sql]DateDiff(dd,DateReceive,GetDate())[/sql]





-------------------------
Ghost
Pages: (1)   [1]

search this forum: