1

Re: Mark all records in a survey as confidential

Has anyone developed a batch update - that they are willing to share - that will do this? Or have I missed another way to do it?

Rich

Richard Burkmar
Biodiversity Project Officer
Field Studies Council

2

Re: Mark all records in a survey as confidential

I haven't got one, but have put together the following. Please take backup and check results  though. Works as a Quick Batch Update on a Survey selected in the observation hierarchy and only on records for which you are the Custodian. If you are not sure how to get the following into a batch update please ask.

Mike
.
<?xml version="1.0" ?>
<batchupdate menupath="LcBatchUpdates" title="LCBU20- Change Confidential flag for a Survey  "
description="Changes the Confidential flag for all occurrences in the databse for the selected Survey. Works for a selected Survey only" >

<SQL>

<Where keytype="Default">


</Where>

<Where keytype="Survey">

UPDATE Taxon_Occurrence  set


<Condition field= "Confidential"   operator="equal" type="OptionSet"  name="Set Confidential Equals"  >
        <Option name="True" value = "1" />
        <Option name="False" value = "0" />
     
</Condition>


FROM TAXON_OCCURRENCE TOCC INNER JOIN
SAMPLE S ON S.SAMPLE_KEY = TOCC.SAMPLE_KEY
INNER JOIN SURVEY_EVENT SE
ON SE.SURVEY_EVENT_KEY = S.SURVEY_EVENT_KEY
WHERE SE.SURVEY_KEY = '%s'
AND TOCC.CUSTODIAN  = (SELECT DATA FROM SETTING WHERE [NAME] = 'SiteID')



</Where>


</SQL>
</batchupdate>

Mike Weideli

3

Re: Mark all records in a survey as confidential

Thanks very much for this Mike. The fly in my ointment was that I am not the custodian. The custodian is another R6 user in our region. We want to exclude some of his surveys from the records we use to fulfil data requests until he has verified the records they contain. The most convenient way for us to to this is to mark them as confidential. I don't want to ask him to mark them as confidential in his copy of R6 because that would not be convenient for his day-to-day work. In the end I found that my predecessor - Hannah Betts - had already come up with a solution which is an update query - shown below - to be run directly on SQL Server.

UPDATE    TAXON_OCCURRENCE
SET              CONFIDENTIAL = 1
FROM         SURVEY INNER JOIN
                      SURVEY_EVENT ON SURVEY.SURVEY_KEY = SURVEY_EVENT.SURVEY_KEY INNER JOIN
                      SAMPLE ON SURVEY_EVENT.SURVEY_EVENT_KEY = SAMPLE.SURVEY_EVENT_KEY INNER JOIN
                      TAXON_OCCURRENCE ON SAMPLE.SAMPLE_KEY = TAXON_OCCURRENCE.SAMPLE_KEY
WHERE     (SURVEY.ITEM_NAME = 'name of survey')

Richard Burkmar
Biodiversity Project Officer
Field Studies Council

4

Re: Mark all records in a survey as confidential

I just took another look at Mike's batch update. Is the restriction on updating records for which you are the custodian built into the batch update itself? I had assumed that it was Recorder, not the batch update that was applying the restriction, but I see that I may be wrong. In which case, could I just have modified the where clause in Mike's batch update?

Richard Burkmar
Biodiversity Project Officer
Field Studies Council

5

Re: Mark all records in a survey as confidential

The restrictions are in the batch update.  I could not suggest or supply a batch update which violated the principles of custodianship. In principle if you can't do something through the observation hierarchy, you shouldn't do it via a batch update, although there is nothing stopping you. In this instance it probably doesn't matter too much, but   in principle changing records where you are not the custodian  is not a good idea.

Mike Weideli

6

Re: Mark all records in a survey as confidential

A good way of 'removing' records from reports, etc. while not violating the principle of only editing data you are custodian of is to add a new determination that is either 'invalid' or 'requires confirmation'. The benefit of doing this, as opposed to marking as confidential, is that you can add comments that explains the situation with the record and, of course, it's perfectly acceptable to add a determination to a record you are not custodian of.

Charles Roper
Digital Development Manager | Field Studies Council
http://www.field-studies-council.org | https://twitter.com/charlesroper | https://twitter.com/fsc_digital