I have a requirement to generate a list of 5 records from one database table randomly. That part I have working. I created a sql statement as follows:
SELECT TOP 5 LICENSE.LICENSENO, LICENSE.LICENSECAT, LICENSE.LICENSEKEY"
FROM LICENSE WHERE LICENSE.LICENSEKEY <>1 AND LICENSE.ISSDTTM IS NOT NULL AND LICENSE.LICSTATUS = 'Active' ORDER BY NEWID()
The above statement generates a list of 5 records randomly selected. If i run the same statement again it generates a new list of five items.......perfect.
The problem i have is with the second part of the requirements which state that for every record that is returned I need to update the Database based on the licensekey. The purpose of this is to avoid records that have been selected in the past to not be selected again.
I was thinking i can write a sql command and put it in a subreport. then place that subreport in the group header. Everytime the main report is run i want it to update the 5 records it returned.
You could add a new column to the database called SELECTED (boolean) Default it to FALSE and update to TRUE when you select it.
Change the selection to
SELECT TOP 5 LICENSE.LICENSENO, LICENSE.LICENSECAT, LICENSE.LICENSEKEY"
FROM LICENSE WHERE LICENSE.LICENSEKEY <>1 AND LICENSE.ISSDTTM IS NOT NULL AND LICENSE.LICSTATUS = 'Active' ORDER BY NEWID()
AND Not LICENSE.Selected
mlmcc