<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.officezealot.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Don Reamey's InfoPath Weblog : predicate, Filters, XSL</title><link>http://blogs.officezealot.com/dreamey/archive/tags/predicate/Filters/XSL/default.aspx</link><description>Tags: predicate, Filters, XSL</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.2)</generator><item><title>Implementing XSL predicates or filters on InfoPath Forms Server 2010</title><link>http://blogs.officezealot.com/dreamey/archive/2010/01/21/21673.aspx</link><pubDate>Fri, 22 Jan 2010 06:44:00 GMT</pubDate><guid isPermaLink="false">a446e06f-2cc4-48dd-a534-c024bd1e2687:21673</guid><dc:creator>dreamey</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.officezealot.com/dreamey/comments/21673.aspx</comments><wfw:commentRss>http://blogs.officezealot.com/dreamey/commentrss.aspx?PostID=21673</wfw:commentRss><description>&lt;P style="MARGIN:0in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;If you downloaded the beta version of InfoPath Forms Service as part of SharePoint 2010 then you will get the chance to try out filtering data in browser forms.&lt;/P&gt;
&lt;P style="MARGIN:0in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN:0in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;Filtering is supported on the following controls:&lt;/P&gt;
&lt;P style="MARGIN:0in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN:0in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;Repeating tables, Repeating sections , List Box, Bulleted List, Drop-Down List Box and Numbered List.&lt;/P&gt;
&lt;P style="MARGIN:0in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN:0in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;If your familiar with InfoPath 2007, then filters are applied to controls in the same way. You can review the following document for how you apply a filter: &lt;A href="http://office.microsoft.com/en-us/infopath/HP011066141033.aspx"&gt;http://office.microsoft.com/en-us/infopath/HP011066141033.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P style="MARGIN:0in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN:0in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;What I want to discuss in this article is how the filters were implemented on the server.&lt;/P&gt;
&lt;P style="MARGIN:0in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL style="FONT-STYLE:normal;MARGIN-TOP:0in;unicode-bidi:embed;FONT-FAMILY:Calibri;DIRECTION:ltr;MARGIN-BOTTOM:0in;MARGIN-LEFT:0.375in;FONT-SIZE:11pt;FONT-WEIGHT:normal;"&gt;
&lt;LI style="MARGIN-TOP:0px;MARGIN-BOTTOM:0px;VERTICAL-ALIGN:middle;"&gt;&lt;SPAN style="FONT-STYLE:normal;FONT-FAMILY:Calibri;FONT-SIZE:11pt;VERTICAL-ALIGN:baseline;FONT-WEIGHT:normal;TEXT-DECORATION:none;"&gt;Deploying the form.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;OL style="FONT-STYLE:normal;MARGIN-TOP:0in;unicode-bidi:embed;FONT-FAMILY:Calibri;DIRECTION:ltr;MARGIN-BOTTOM:0in;MARGIN-LEFT:0.375in;FONT-SIZE:11pt;FONT-WEIGHT:normal;"&gt;
&lt;LI style="MARGIN-TOP:0px;MARGIN-BOTTOM:0px;VERTICAL-ALIGN:middle;"&gt;&lt;SPAN style="FONT-STYLE:normal;FONT-FAMILY:Calibri;FONT-SIZE:11pt;VERTICAL-ALIGN:baseline;FONT-WEIGHT:normal;TEXT-DECORATION:none;"&gt;When a form is deployed to InfoPath server the .XSN file which contains among other things the .XSL file. The .XSL file is where you will find the XSL predicates or filters. Unlike rules or calculations which are stored in the .XSF file and are InfoPath specific. The predicates found in the .XSL file are predicates which comply with standard XSL predicates in the form of:&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/OL&gt;
&lt;P style="MARGIN:0in 0in 0in 0.75in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN:0in 0in 0in 0.75in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;x/y/z[expression]&lt;/P&gt;
&lt;P style="MARGIN:0in 0in 0in 0.75in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN:0in 0in 0in 0.75in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;Where x/y/z is an Xpath and [expression] is an XSL predicate.&lt;/P&gt;
&lt;P style="MARGIN:0in 0in 0in 0.75in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN:0in 0in 0in 0.75in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;During deployment the XSL is parsed and each expression is evaluated for several criteria. One of the criteria that is evaluated is complexity of the expression. This means several things such as does the expression contain constant values or does it have references to nodes in the main DOM or an auxiliary DOM.&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;Based on the complexity of the expression the nodes involved in the expression may be marked to post back to the server when a value is changed. &lt;/P&gt;
&lt;P style="MARGIN:0in 0in 0in 0.75in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN:0in 0in 0in 0.75in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;Also during the deployment process JavaScript expressions are generated. In the case where an node is not marked to post back to the server the JavaScript expression would be used in the browser. Another form of complexity is when a JavaScript version of the expression can't be generated. This can occur when there are nodes that are "out of context" of the expression. When I say out of context I mean that the expression could reference nodes that are in an auxiliary DOM or nodes that are not a sibling of the nodes in the XPath expression.&lt;/P&gt;
&lt;P style="MARGIN:0in 0in 0in 0.75in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN:0in 0in 0in 0.75in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;After the expressions are evaluated the deployment process continues and a binary form of the InfoPath Form data is written to the SharePoint database.&lt;/P&gt;
&lt;P style="MARGIN:0in 0in 0in 0.75in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL style="FONT-STYLE:normal;MARGIN-TOP:0in;unicode-bidi:embed;FONT-FAMILY:Calibri;DIRECTION:ltr;MARGIN-BOTTOM:0in;MARGIN-LEFT:0.375in;FONT-SIZE:11pt;FONT-WEIGHT:normal;"&gt;
&lt;LI style="MARGIN-TOP:0px;MARGIN-BOTTOM:0px;VERTICAL-ALIGN:middle;"&gt;&lt;SPAN style="FONT-STYLE:normal;FONT-FAMILY:Calibri;FONT-SIZE:11pt;VERTICAL-ALIGN:baseline;FONT-WEIGHT:normal;TEXT-DECORATION:none;"&gt;Rendering of the form&lt;/SPAN&gt;&lt;/LI&gt;
&lt;OL style="FONT-STYLE:normal;MARGIN-TOP:0in;unicode-bidi:embed;FONT-FAMILY:Calibri;DIRECTION:ltr;MARGIN-BOTTOM:0in;MARGIN-LEFT:0.375in;FONT-SIZE:11pt;FONT-WEIGHT:normal;"&gt;
&lt;LI style="MARGIN-TOP:0px;MARGIN-BOTTOM:0px;VERTICAL-ALIGN:middle;"&gt;&lt;SPAN style="FONT-STYLE:normal;FONT-FAMILY:Calibri;FONT-SIZE:11pt;VERTICAL-ALIGN:baseline;FONT-WEIGHT:normal;TEXT-DECORATION:none;"&gt;When the form is rendered in the browser all of the filter expression will be evaluated on the server before the form is displayed.&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;For instance if a List Box is contains the names of all of the United States and the filter expression is something like this:&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/OL&gt;
&lt;P style="MARGIN:0in 0in 0in 0.75in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN:0in 0in 0in 0.75in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;[stateField = field1]&lt;/P&gt;
&lt;P style="MARGIN:0in 0in 0in 0.75in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN:0in 0in 0in 0.75in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;Then the List Box filter expression will be evaluated and the data that satisfies the expression will be sent to the browser.&lt;/P&gt;
&lt;P style="MARGIN:0in 0in 0in 0.75in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN:0in 0in 0in 0.75in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;For repeating sections and tables the rendering process behaves slightly different. The expression will still be evaluated however rows that do not satisfy the condition will be marked to not render in the browser. This means that if your repeating table contains 50 rows but only 1 row meets the filter criteria then all 50 rows will be sent to the browser but only one row will be visible in the browser.&lt;/P&gt;
&lt;P style="MARGIN:0in 0in 0in 0.75in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN:0in 0in 0in 0.75in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;This is done because in InfoPath the data in repeating sections and repeating tables may be used in a calculation such as a summation. So in this case it is necessary to hide rows that don't satisfy the expression.&lt;/P&gt;
&lt;P style="MARGIN:0in 0in 0in 0.75in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL style="FONT-STYLE:normal;MARGIN-TOP:0in;unicode-bidi:embed;FONT-FAMILY:Calibri;DIRECTION:ltr;MARGIN-BOTTOM:0in;MARGIN-LEFT:0.375in;FONT-SIZE:11pt;FONT-WEIGHT:normal;"&gt;
&lt;LI style="MARGIN-TOP:0px;MARGIN-BOTTOM:0px;VERTICAL-ALIGN:middle;"&gt;&lt;SPAN style="FONT-STYLE:normal;FONT-FAMILY:Calibri;FONT-SIZE:11pt;VERTICAL-ALIGN:baseline;FONT-WEIGHT:normal;TEXT-DECORATION:none;"&gt;Runtime of the Form&lt;/SPAN&gt;&lt;/LI&gt;
&lt;OL style="FONT-STYLE:normal;MARGIN-TOP:0in;unicode-bidi:embed;FONT-FAMILY:Calibri;DIRECTION:ltr;MARGIN-BOTTOM:0in;MARGIN-LEFT:0.375in;FONT-SIZE:11pt;FONT-WEIGHT:normal;"&gt;
&lt;LI style="MARGIN-TOP:0px;MARGIN-BOTTOM:0px;VERTICAL-ALIGN:middle;"&gt;&lt;SPAN style="FONT-STYLE:normal;FONT-FAMILY:Calibri;FONT-SIZE:11pt;VERTICAL-ALIGN:baseline;FONT-WEIGHT:normal;TEXT-DECORATION:none;"&gt;When the form is up and running and the user is entering data each field in the browser is mapped to a node in the XML. If one of the nodes in the XML is part of a filter expression then filter will be evaluated when the node is changed. At this point one of two things will happen. One, if the filter is marked to post back the form will send data to the server and the filter will be evaluated on the server and the rendering process will take place again. Two,&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;if the filter is not marked to post back then the filter will be evaluated in the browser and no post back will occur.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/OL&gt;
&lt;P style="MARGIN:0in;FONT-FAMILY:Calibri;FONT-SIZE:11pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.officezealot.com/aggbug.aspx?PostID=21673" width="1" height="1"&gt;</description><category domain="http://blogs.officezealot.com/dreamey/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://blogs.officezealot.com/dreamey/archive/tags/Office+2010/default.aspx">Office 2010</category><category domain="http://blogs.officezealot.com/dreamey/archive/tags/InfoPath+2010/default.aspx">InfoPath 2010</category><category domain="http://blogs.officezealot.com/dreamey/archive/tags/Filters/default.aspx">Filters</category><category domain="http://blogs.officezealot.com/dreamey/archive/tags/XSL/default.aspx">XSL</category><category domain="http://blogs.officezealot.com/dreamey/archive/tags/predicate/default.aspx">predicate</category></item></channel></rss>