Hyperlinks and queries to Forms
Simple
Navigate to a specific form
In your GUI file each of your forms has a unique name, for example:
<form name="Individuals" entity="Individual" />
You can navigate to this form by using 'select':
http://my.server.org:8080/myapp/molgenis.do?select=Individuals
Apply a filter
To select a form and apply a filter at the same time, use 'target' and 'filter_set'. Note that 'select' does not work here! Then specify the filter with 'filter_attribute', 'filter_operator', and 'filter_value' as you normally build query rules.
For example, show the individual with ID = 5:
http://my.server.org:8080/myapp/molgenis.do?__target=Individuals&__action=filter_set&__filter_attribute=Individual_id&__filter_operator=EQUALS&__filter_value=5
Practical example
Say we have a variable ${outputDataName} which contains the name of a 'Data' matrix. You can create a link to this record from any template like this:
<a href="/${model.deployName}/molgenis.do?__target=Data&__action=filter_set&__filter_attribute=Data_name&__filter_operator=EQUALS&__filter_value=${outputDataName}">${outputDataName}</a>
Notice you need the deploy name ('myapp' in previous examples) to make a correct hyperlink. This is available from the MolgenisServlet and can be set using:
this.model.setDeployName(MolgenisServlet.getMolgenisVariantID());
Advanced
You can do more advanced operators, such as:
EQUALS, NOT, LIKE, LESS, GREATER, LESS_EQUAL, GREATER_EQUAL
Get all markers with an 'e' somewhere in their name:
http://my.server.org:8080/myapp/molgenis.do?__target=Markers&__action=filter_set&__filter_attribute=Marker_name&__filter_operator=LIKE&__filter_value=e
Get all markers with a centimorgen position greater than 21.8:
http://my.server.org:8080/myapp/molgenis.do?__target=Markers&__action=filter_set&__filter_attribute=Marker_cM&__filter_operator=GREATER&__filter_value=21.8
You can also use 'filter_add' and 'filter_remove' instead of 'filter_set'. This allows you to stack multiple filters with a default AND operator.
For example, get all markers with an 'o' in their name, located between 40.0 and 50.0 centimorgan:
http://my.server.org:8080/myapp/molgenis.do?__target=Markers&__action=filter_set&__filter_attribute=Marker_name&__filter_operator=LIKE&__filter_value=o http://my.server.org:8080/myapp/molgenis.do?__target=Markers&__action=filter_add&__filter_attribute=Marker_cM&__filter_operator=LESS&__filter_value=50.0 http://my.server.org:8080/myapp/molgenis.do?__target=Markers&__action=filter_add&__filter_attribute=Marker_cM&__filter_operator=GREATER&__filter_value=40.0
This can't be a single hyperlink because of all the duplicate variable names. ('filter_attribute' etc) So I'm not completely sure when you would use it like this.
Discussion
Applying operators other than AND
Is it possible to apply an OR operator, either when using hyperlinks or even (especially!) in the MOLGENIS GUI itself?
For example, select markers 'PVV4' and 'AXR1' using something like:
http://my.server.org:8080/myapp/molgenis.do?__target=Markers&__action=filter_set&__filter_attribute=Marker_name&__filter_operator=EQUALS&__filter_value=PVV4 http://my.server.org:8080/myapp/molgenis.do?__target=Markers&__action=filter_add&__filter_operator=OR http://my.server.org:8080/myapp/molgenis.do?__target=Markers&__action=filter_set&__filter_attribute=Marker_name&__filter_operator=EQUALS&__filter_value=AXR1
Again, I don't know how to do this in the MOLGENIS GUI either, I don't think it's possible? You would expect some buttons next to the 'Search:' area with AND, OR, XOR, NAND, etc. Which is then concatenated to the filter, but not in effect until a second attribute-operator-value is entered. Ofcourse this is hard because of nesting and syntax checking. Maybe we want a proper querybuilder for this? On the other hand, just being able to swap the default 'AND' into an 'OR' would be a big bonus.
Using JOIN
Using hyperlink calls, it is possible to apply a JOIN. This behaves as if it was applied through the 'Search:' in the GUI. What does this do, how does it behave, and when would you use this? Example:
http://my.server.org:8080/myapp/molgenis.do?__target=Markers&__action=filter_set&__filter_attribute=chromosome_name&__filter_operator=JOIN&__filter_value=Chromosome