Source language: Translate to:

plugin neobookdb 2.3d - creating dbfquery

Plug-ins and utilities of interest to NeoBook authors

Moderator: Neosoft Support

plugin neobookdb 2.3d - creating dbfquery

Postby Skarabäus » Wed Sep 13, 2006 1:48 am

neobookers:

i work with the amazing plugin of hans-peter (hpwutility) which i wanna use in combination with neobookdb to filter records via dates.

- there are two variables ([Date1] , [Date2] ) where the chosen dates, selected via hans-peters calendars, are stored
- within the database there are two columns (DATEFROM,DATETO) which contains dates
- the query code itself is stored in a query button used by the user after selected the two dates

Now, my intension is to create a code below:
unfortunately this doesn't work!?

dbfQuery "xyz.dbf" "DATEFROM>=[Date1] AND DATETO=<[Date2]"
If "[dbfQueryResult]" ">" "0"
dbfQuery "xyz.dbf" "DATEFROM>[Date1] AND DATETO<[Date2]"
else
dbfShowAll "xyz.dbf"
endIf

but the grazy thing is that the following code works:

dbfQuery "xyz.dbf" "DATEFROM=[Date1] AND DATETO=[Date2]"
If "[dbfQueryResult]" ">" "0"
dbfQuery "xyz.dbf" "DATEFROM=[Date1] AND DATETO=[Date2]"
else
dbfShowAll "xyz.dbf"
endIf

Can anyone tell me why, what is my mistake and is there maybe a better way to go?

Thanks a lot.
Skarabäus
User avatar
Skarabäus
 
Posts: 37
Joined: Mon May 15, 2006 4:31 am
Location: Germany, Ostfildern

Postby HPW » Wed Sep 13, 2006 1:52 am

I am not sure if the >= operator works on date-strings.
Hans-Peter
User avatar
HPW
 
Posts: 2510
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Postby Skarabäus » Wed Sep 13, 2006 2:00 am

hans-peter:

thanks for you remark. i try to go other way in converting the dates in integer value or maybe better in string keeping the leading zero.
Skarabäus
User avatar
Skarabäus
 
Posts: 37
Joined: Mon May 15, 2006 4:31 am
Location: Germany, Ostfildern

Postby Gaev » Wed Sep 13, 2006 9:38 am

Skarabaus:
i try to go other way in converting the dates in integer value
... NeoBook v5+ has ...
Code: Select all
DateToNum "date" "format" "variable"

Convert a formatted date to a number that can be used in mathematical calculations. The result, a numeric date, represents the number of days since December 30, 1899. A numeric date can be converted back into a formatted date with the NumToDate Action.
... so if you store this as a largeInt, you can use the kind of dbfQuery commands you want.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada


Return to NeoBook Plug-Ins and Utilities

Who is online

Users browsing this forum: No registered users and 1 guest