InfoPath Hyperlink Control: Show Hyperlink Based on Filtered Data

By | March 11, 2010

In InfoPath, Hyperlink control does not support filtering data when you select a field for repeating group. But you can definitely avert this limitation using a trick. For example, I have secondary data source “Data” as xml file with the following content

<?xml version="1.0" encoding="utf-8" ?>
<Settings>
<Setting Name="Users" Value="2" />
<Setting Name="WebAddress" Value="http://blog.vishalon.net" />
</Settings>

Now I want to get a hyperlink out of “Value” attribute of “Setting” node whose “Name” is “WebAddress”.When I insert Hyperlink control and try to select the “Name” node, it will not show any “Filter Data..” button

infopath-hyperlink-no-filter

The only trick to get filter data working is to manually enter full XPath expression into hyperlink. For this, insert Expression Box and in XPath expression, select the whole expression with filtered data. and press “OK” button for all open dialogs. Now open “Properties…” for the expression box, copy the Data source XPath expression. Now try to insert the hyperlink control and instead of selecting XPath expression, paste the copied expression, type text “My Blog” and hit “OK”.
infopath-hyperlink-manual-xpath

Now when you preview the form, you will get the actual hyperlink.
infopath-hyperlink-preview

Attached: InfoPath HyperLink Control Filter Data Example

Leave a Reply

Your email address will not be published. Required fields are marked *