Hi Wayne,
To do an updateRows properly, you need to identify the Primary Key for the table you're working against. When it comes to a dataset, the Primary Key is usually the LSID as you observed.
Take a look at my basic Javascript updateRows function that I used in a wiki to change the Race of one of the records:
<script type="text/javascript">
LABKEY.Query.updateRows({
schemaName: 'study',
queryName: 'Dataset001',
rows: [{"lsid": "urn:lsid:labkey.com:Study.Data-122:5003.1001.20171030.0000",
"Race": "Native"
}],
success: function(data) {
alert("Record is updated!");
}
})
</script>
As you can see, it uses the lsid to identify the specific row since it's the primary key for the table, then updates the specific field.
I managed to do the same exact thing using R:
> library(Rlabkey)
Loading required package: RCurl
Loading required package: bitops
Loading required package: rjson
> updaterow=data.frame(lsid="urn:lsid:labkey.com:Study.Data-122:5003.1001.20171030.0000", Race="Asian")
> updatedRow <- labkey.updateRows(baseUrl="
http://localhost:8080/labkey", folderPath="/WayneTest", schemaName="study", queryName="Dataset001", toUpdate=updaterow)
> updatedRow
$rowsAffected
[1] 1
$queryName
[1] "Dataset001"
$schemaName
[1] "study"
$containerPath
[1] "/WayneTest"
$rows
$rows[[1]]
$rows[[1]]$date
[1] "2017/10/30 00:00:00"
$rows[[1]]$`Saliva Dt`
[1] "2015/12/31 00:00:00"
$rows[[1]]$dsrowid
[1] 12
$rows[[1]]$WGS
NULL
$rows[[1]]$CreatedBy
[1] 1005
$rows[[1]]$WES
NULL
$rows[[1]]$QCState
NULL
$rows[[1]]$CIDR
[1] "1"
$rows[[1]]$Created
[1] "2017/11/04 20:41:02"
$rows[[1]]$lsid
[1] "urn:lsid:labkey.com:Study.Data-122:5003.1001.20171030.0000"
$rows[[1]]$Ethnicity
[1] "non-hispanic"
$rows[[1]]$sourcelsid
NULL
$rows[[1]]$Race
[1] "Asian"
$rows[[1]]$Birthyr
[1] 2001
$rows[[1]]$`Buccal Dt`
[1] "2015/12/20 00:00:00"
$rows[[1]]$SampleID
[1] "1001"
$command
[1] "update"
==========
Can you provide more information on what you mean by "global delete"? Do you mean deleting multiple rows? What did you mean when you say that you "don't know what are the values for this field" with regard to the LSID? Are you talking about obtaining the LSID from the dataset or are you talking about the LSID format, such as "urn:lsid:labkey.com:Study.Data-122:5003.1001.20171030.0000"?
Regards,
Jon