In this step, we explore two ways to use the URL property.
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 is encoded at the end. This will show only rows where the species is Rat.
Next we'll modify the design of the list to create the links.
- Click Design.
- Click Edit Design.
- Select the Species field by clicking in its Name box.
- On the Display tab in the field properties box, 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}". (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 up and click Save.
- Click Done.
- Clear the "Species=Rat" filter using the in the filter bar, or clicking the column header Species and then clicking Clear Filter.
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, that you can use in the list design:
This generalized version is already included in the list design in our example archive.
- Click the List Tutorial link near the top of the page, then click the NIMHDemographics list in the Lists web part.
- Click Design.
- Click Edit Design.
- Select the CartoonAvailable field by clicking its Name box.
- Notice the URL property for this field. It is the generalized version of the link above.
- Scroll up to click Cancel, then Done 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