programmatically determine whether records exist

Kenneth Brody kenbrody at spamcop.net
Sat Feb 14 19:09:51 PST 2015


On 2/12/2015 7:52 PM, Bob Haussmann wrote:
> We are trying to find a way to programmatically determine (i.e., in a batch
> file-no user interaction) whether any given filePro database contains one or
> more records (Windows environment, fP 5.7).  Our first thought was to use
> fpSQL to run a query like the following:
[...]
> We also thought about checking to see if the size of key/data is zero,
> however this wouldn't work if dexpand had been run.

NB: This is untested, but "should" work.

Make a pair of processing tables:

Sort/select:

     If: ''' If it gets here, there are records in the file.  Export
   Then: ''' some "there are records" value to a file.
     If:
   Then: exit ''' Make sure to end the code with "exit"

Output:

@done
     If: ''' If it gets here, there are no records in the file.  Export
   Then: ''' some "there are no records" value to a file.

Run dreport with "-a", and appropriate "-v" and "-fp" flags.

-- 
Kenneth Brody


More information about the Filepro-list mailing list