labkey.deleteRows laurapas  2016-02-10 12:57
Status: Closed
 
Hi Jon,
The rows are definitely there. I even populated Key with integers myself. 'Key' is actually invisible to the default view, but it's definitely in the columns list. I attached screenshots of the list design and schema browser.

I started from scratch by manually deleting the rows using 'Delete All Rows' in the schema browser. Then, I ran the code below. Inserting rows works like a charm, but I cannot delete them.

.......other code before this part....
import_AuDIT$Key <- seq_along(import_AuDIT$peptide)

labkey.insertRows(baseUrl = "https://labkey-dev.roche.com:8443/labkey",
                  folderPath = "/gRED/QuaSAR Dev 2/QuaSAR Dev 2 results",
                  schemaName = "lists",
                  queryName = "QuaSAR_AuDIT",
                  toInsert = import_AuDIT)

labkey.deleteRows(baseUrl="https://labkey-dev.roche.com:8443/labkey",
                  folderPath="/gRED/QuaSAR Dev 2/QuaSAR Dev 2 results",
                  schemaName="lists",
                  queryName="QuaSAR_AuDIT",
                  toDelete=data.frame(Key=1:3888,
                                      stringsAsFactors = FALSE)
                  )

$rowsAffected
[1] 3888

$queryName
[1] "QuaSAR_AuDIT"

$schemaName
[1] "lists"

$containerPath
[1] "/gRED/QuaSAR Dev 2/QuaSAR Dev 2 results"

$rows
list()

$command
[1] "delete"


I think there's something wrong with the primary key and I don't know what it is. I tried to select via the Key, but that returns an data frame with columns but 0 observations.

testselect <- labkey.selectRows(
  baseUrl="https://labkey-dev.roche.com:8443/labkey",
  folderPath="/gRED/QuaSAR Dev 2/QuaSAR Dev 2 results",
  schemaName="lists",
  queryName="QuaSAR_AuDIT",
  viewName="",
  colNameOpt = "fieldname",
  colFilter=makeFilter(c("Key", "IN", "1")),
  containerFilter=NULL
)

> str(testselect)
'data.frame':    0 obs. of 14 variables:
 $ peptide : num
 $ sample : num
 $ transition.id: num
 $ pvalue.final : num
 $ status : num
 $ final.call : num
 $ SkylineNumber: num
 $ Category : num
 $ Panel : num
 $ Conc : num
 $ ConcLevel : num
 $ protein : num
 $ cv : num
 $ cv.status : num