In this previous step, we used lookups to link our lists to each other. In this step, we explore two ways to use the URL property of list fields to create other links that might be useful to researchers using the data.

Create Links to Filtered Results

It can be handy to generate an active filtering link in a list or dataset. For example, here we use a URL property to turn the values in the species column into links to a filtered subset of the data. When you click one species value, you get a grid showing only subjects of the same species.

  • Click the List Tutorial link above the grid to return to the main folder page.
  • From the Lists web part, click NIMHDemographics to open the grid view of the list.
  • Notice that in the "Species" column, the values are just text, not links (yet).
  • Click the column header Species, then Filter....
  • Click the label Rat to select only that single value.
  • Click OK.
  • Notice the URL in your browser, which might look something like this - the full path and your list ID number may vary, but the filter you applied (Species = Rat) is encoded at the end. This will show only rows where the species is Rat.
    http://localhost:8080/labkey/Tutorials/List%20Tutorial/list-grid.view?listId=277&query.Species~eq=Rat
  • Clear the "Species=Rat" filter using the in the filter bar, or by clicking the column header Species and then clicking Clear Filter.

Next we'll modify the design of the list to turn the values in the Species column into custom links that filter to just the species name that we click.

  • Click Design.
  • Click the Fields section to expand it.
  • Scroll down and click the expansion icon for the Species field.
  • Enter this value for the URL field:
/list/grid.view?name=NIMHDemographics&query.Species~eq=${Species}
    • The filter portion of this URL replaces "Rat" with the substitution string "${Species}", meaning the value of the Species column. (If we were to specify "Rat", clicking any species link in the list would filter the list to only show the rats!)
    • The "listId" portion of the URL has been replaced with "name=NIMHDemographics."
  • Scroll down and click Save.

Now notice that the values in the "Species" column are all links. When you click one, you will get the filtering behavior we just defined.

  • Click Field mouse in any row and you will see the demographics list filtered to display only rows for field mice.

Create Links to Files

A column value can also include link to a file. All the values in a column could link to a fixed file (such as to a protocol document) or you can make row-specific links to files where a portion of the filename matches a value in the row such as the Subject ID in this example. Open this link in a new browser window:

Edit the URL, incrementing the file name 20023.png, 20024.png, 20025.png. These are simply cartoon images of our sample characters stored on a public server, but in actual use you might have slide images or other files of interest stored on your local machine and named by subjectId.

Here is a generalized version, using substitution syntax for the URL property, for use in the list design. It is already included in the list archive we provided.

http://www.labkey.org/files/home/Demos/ListDemo/sendFile.view?fileName=%40files%2F${SubjectID}.png&renderAs=IMAGE

  • Click the List Tutorial link near the top of the page, then click the NIMHDemographics list in the Lists web part.
  • Click Design.
  • Click the expansion icon to expand the CartoonAvailable field.
  • Notice the URL property for this field. It is the generalized version of the link above.
  • Scroll down to click Cancel to return to the grid for this list.
  • Observe that clicking true in the CartoonAvailable column opens an image of the 'subject' in that row. Click the 'true' link for the SubjectID 20022 to see the same image you opened earlier.

Congratulations

You've now completed the list tutorial. Learn more about lists in the related topics.

Related Topics

Previous Step

Discussion

Was this content helpful?

Log in or register an account to provide feedback


previousnext
 
expand all collapse all