Source language: Translate to:

dbfquery problem

Questions about NeoBook PlugIns

Moderator: Neosoft Support

dbfquery problem

Postby Wrangler » Thu Jul 06, 2006 5:15 pm

I have a db with a date field. I want to check if the date in this field is less than or equal to today's date. Date format is 7/5/2006.

dbfQuery "[pubdir]meds.dbf" "expdate <= ![dateshort]"

Can't get this to work.

Also tried:

SetVar "[todaydate]" "![dateshort]"
dbfQuery "[pubdir]meds.dbf" "expdate <= [todaydate]"

Also tried making date field a string. Didn't work.

If today is 7/6/2006, and expdate is 7/5/2006, it should find this field?

Using NeoDB 2.3c and NB 5.5.
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1505
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby Gaev » Thu Jul 06, 2006 6:48 pm

Wrangler:

This worked for me ...
Code: Select all
dbfQuery "[pubdir]meds.dbf" "expdate <= [dateshort]"
... i.e Without the Excamation Mark.

P.S. My windows date format is dd/mm/ccyy
User avatar
Gaev
 
Posts: 3717
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Wrangler » Thu Jul 06, 2006 7:09 pm

Hmmmm. Maybe it's the date format. Well, I'm tired of fartin' with it. I tried every combo I could come up with. It just won't grab the record dated yesterday. I ended up with a workaround that only took a few extra lines of code:

DateToNum "[dateshort]" "m/d/y" "[todaydate]"
dbfQuery "[pubdir]meds.dbf" "medname<>0"
setvar "[prodfound]" "[dbfqueryresult]"
If "[prodfound]" ">" "0"
Loop "1" "[prodfound]" "[x]"
DateToNum "[meds.expdate]" "m/d/y" "[expdate]"
If "[expdate]" "<=" "[todaydate]"
SetVar "[meds.expdate]" "EXPIRED"
FileWrite "[pubdir]temp.dat" "Append" "[meds.medname]"
endif
If "[x]" "<>" "[prodfound]"
dbfNext "[pubdir]meds.dbf"
EndIf
EndLoop
EndIf
dbfShowAll "[pubdir]meds.dbf"

If it finds any expired dates, it writes the med name to a file, which is regurjitated into a list box in a warning container, listing which meds have expired. I had to change the date field to a string to get it to write EXPIRED to it, though.

But thanks for checking it out for me. Next time it comes around on the gitar, I'll look at it again.

Added later: What's the cc in /ccyy stand for? :cry:
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1505
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby domino » Fri Jul 07, 2006 10:05 am

century
User avatar
domino
 
Posts: 275
Joined: Sat Apr 02, 2005 7:11 am
Location: Notts UK


Return to PlugIn Discussions

Who is online

Users browsing this forum: No registered users and 2 guests

cron