This topic is locked
[SOLVED]

 Count of days

6/1/2012 2:14:56 PM
ASPRunnerPro General questions
K
kleanthis author

I have an SQL database that contains a table that has two days entry, the startDay and the endDay and a NumOfDays.
startDay endDay NumOfDays
I want when I enter the starDay and the endDay to return the count of the days in the NumOfDays column.

I enter the following code in the event before record added in the add page.
dict("NumOfDays") = datediff ("d",startDay, endDay)

BeforeAdd=true

The problem is that always is returning the number 0.

(the data format for the days in the SQL are date)
Please help.

Sergey Kornilov admin 6/3/2012

Not sure what is your version of ASPRunnerPro or what event you use. Anyway you should use dict("startDay") or values("startDay") instead of startDay.

K
kleanthis author 6/3/2012

[/b][/b]>

Not sure what is your version of ASPRunnerPro or what event you use. Anyway you should use dict("startDay") or values("startDay") instead of startDay.


I am using AspRunner Pro 7.1 build 11708. the e vents are two; before the record addedand after the record addedin the add page.
I try your suggestion but it still returns 0.

Sergey Kornilov admin 6/3/2012

Try to convert raw values to CDate before performing the comparison.

values("NumOfDays") = datediff ("d",CDate(values("startDay)), CDate(values("endDay")))


If this doesn't help post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.

K
kleanthis author 6/4/2012



Try to convert raw values to CDate before performing the comparison.

values("NumOfDays") = datediff ("d",CDate(values("startDay)), CDate(values("endDay")))


If this doesn't help post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.


IT WORKS LIKE A CHARM.
THANKS