How to make a link in a List to a file in the Files tab using R API?

LabKey Support Forum
How to make a link in a List to a file in the Files tab using R API? kristen dang  2021-04-22 17:54
Status: Active
 

Hello,
I have several Lists that include a column listing relevant files which are also loaded in the Files tab. I would like to add a link to the List that points to the file in the Files tab. There is an extensive page on how to do this with the GUI, but I am not sure how to do it with the R labkey package. Can this be done with R?

 
 
chetc (LabKey Support) responded:  2021-05-06 10:45
Status: Closed

Hello Kristen,

I apologize for the delay. We typically try and get to our forum posts within a couple of weeks, but since you are a premium user you can opt to use your support portal. Questions posted there are answered much faster. Let me know if you need assistance getting to that support portal, or if you just wanted to contribute to our forums!

Yes, this is possible via the RLabKey API. You can either create a new list and set the "URL" property at the time of creation or you can modify an existing list. Since your scenario fits the latter I will provide an example of how this can be accomplished. R code example attached.

Steps.

  1. Retrieve the list you want to modify using "labkey.domain.get"
  2. Modify the returned domain to include the URL on the desired field. Use the urlEncoding doc to help you determine the link. Linked below.
  3. Save the modified domain using "labkey.domain.save"

RLabKey: https://cran.r-project.org/web/packages/Rlabkey/Rlabkey.pdf
URL Field Property: https://www.labkey.org/Documentation/wiki-page.view?name=urlEncoding#sub

Thanks,
Chet