programmatically determine whether records exist

Kenneth Brody kenbrody at spamcop.net
Mon Feb 16 08:06:25 PST 2015


On 2/14/2015 10:09 PM, Kenneth Brody wrote:
> 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.

Actually, there's no need to export anything, simply use "EXIT n" and check 
the exit value.

Sort/select:

      If: ''' If it gets here, there are records in the file.
    Then: exit "0"

Output:

@done
      If: ''' If it gets here, there are no records in the file.
    Then: exit "1"


-- 
Kenneth Brody


More information about the Filepro-list mailing list