Page 1 of 1

dbfQuery question

PostPosted: Thu Jul 14, 2016 12:58 pm
by KenHos
Hi - I'm using the db free plugin and when I use dbfQuery in fields that contain different numbers (1-12) the Query for 1 also count 10 and 11 making the count wrong. This is for our camp. We have twelve cabins numbered 1-12 and any thing beginning with a 1 is counted in the cabin 1 count
Here's a sample

dbfQuery "camp.dbf" "CABINNO.=1"
dbfQueryCount "camp.dbf" "[Count1]"
If "[dbfQueryResult]" "<" "1"
SetVar "[count1]" "0"
EndIf

dbfShowAll "camp.dbf"
dbfQuery "camp.dbf" "CABINNO.=2"
dbfQueryCount "camp.dbf" "[Count2]"
If "[dbfQueryResult]" "<" "1"
SetVar "[count2]" "0"
EndIf


And can I change the field type in the free db plugin....If so how!

Thanks so much( Camp starts Monday)

Re: dbfQuery question

PostPosted: Thu Jul 14, 2016 1:56 pm
by Gaev
KenHos:

1) This topic has been posted in the wrong Forum ... this forum is for the NEOAPPBUILDER product ... NeoBookDB plugin works with the NEOBOOK product.

2) I do not believe that NeoBookDB (which is just a bridge to DBase IV type of databases) allows field names that contain characters other than letters and numbers ... so get rid of the dots (after the CABINNO).

3) if your cabin numbers are 1 to 9, 10 to 12 ... and assuming that you defined the field as a string (not number) ...

a) try ...
Code: Select all
dbfQuery "camp.dbf" "CABINNO == 1"

... this same question was answered last week for another user on the forum ... always a good idea to search the forum first ... most of the time, you are not the first to encounter a problem.

b) if you plan to sort records on this field, best to name the cabins 01, 02, 03 etc. or you will get sorted records in a sequence like ...

1
10
11
12
2
3
4