<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/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>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Using count() with secondary datasource</title><link>https://www.infopathdev.com:443/forums/thread/123179.aspx</link><pubDate>Thu, 02 Jul 2020 18:42:59 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:123179</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/123179.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=123179</wfw:commentRss><description>It took me the longest time to understand this stuff. I still find myself saying &amp;quot;up the tree&amp;quot; as I type ../ when writing XPath. :)</description></item><item><title>Re: Using count() with secondary datasource</title><link>https://www.infopathdev.com:443/forums/thread/123178.aspx</link><pubDate>Thu, 02 Jul 2020 18:36:42 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:123178</guid><dc:creator>MemphisDev</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/123178.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=123178</wfw:commentRss><description>That is, by far, the best explanation of how those paths work, I&amp;#39;ve read. I don&amp;#39;t really know why I wasn&amp;#39;t wrapping my head around it. Thank you, again, for the solution as well as the lesson!</description></item><item><title>Re: Using count() with secondary datasource</title><link>https://www.infopathdev.com:443/forums/thread/123177.aspx</link><pubDate>Thu, 02 Jul 2020 18:23:09 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:123177</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/123177.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=123177</wfw:commentRss><description>For me, it is easiest to think of &amp;quot;current()&amp;quot; as meaning &amp;quot;this element&amp;quot; (whether a group, a field, an attribute). So, in the case of your specific function - the TempFilter was the item in the repeating group that we needed to use current for. The rule is on CourseSection, so in this case, current() = &amp;quot;this specific instance of CourseSection&amp;quot; - because there could be a lot of them! Their grandparent is repeating! So, to get to TempFilter in the same Class (which will be in the same ClassGroup) we use current() to indicate this specific course section, go up the tree to the parent of the course section, and get the value of the temp filter that is in the same parent.... does that make sense? Since your other two filter fields are not repeating, it is ok to use the absolute instead of a relative path. :)</description></item><item><title>Re: Using count() with secondary datasource</title><link>https://www.infopathdev.com:443/forums/thread/123176.aspx</link><pubDate>Thu, 02 Jul 2020 18:13:59 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:123176</guid><dc:creator>MemphisDev</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/123176.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=123176</wfw:commentRss><description>So... 1) That worked; thank you SOOOO Much! 2) I guess the trick is, with current(), is that it replaces the entire path?</description></item><item><title>Re: Using count() with secondary datasource</title><link>https://www.infopathdev.com:443/forums/thread/123174.aspx</link><pubDate>Thu, 02 Jul 2020 18:07:21 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:123174</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/123174.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=123174</wfw:commentRss><description>Maybe try this? count(xdXDocument:GetDOM(&amp;quot;BookStoreInventory&amp;quot;)/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:ISBN[../d:year = xdXDocument:get-DOM()/my:myFields/my:Year and ../d:term = xdXDocument:get-DOM()/my:myFields/my:Term and ../d:EventID = current()/../my:TempFilter])</description></item><item><title>Re: Using count() with secondary datasource</title><link>https://www.infopathdev.com:443/forums/thread/123173.aspx</link><pubDate>Thu, 02 Jul 2020 17:42:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:123173</guid><dc:creator>MemphisDev</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/123173.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=123173</wfw:commentRss><description>CourseSection</description></item><item><title>Re: Using count() with secondary datasource</title><link>https://www.infopathdev.com:443/forums/thread/123172.aspx</link><pubDate>Thu, 02 Jul 2020 17:38:58 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:123172</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/123172.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=123172</wfw:commentRss><description>What field is the rule on?</description></item><item><title>Re: Using count() with secondary datasource</title><link>https://www.infopathdev.com:443/forums/thread/123169.aspx</link><pubDate>Thu, 02 Jul 2020 17:32:03 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:123169</guid><dc:creator>MemphisDev</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/123169.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=123169</wfw:commentRss><description>Thanks for the lightning fast reply!!!
Attaching main data screen shot.
I&amp;#39;m using a rule to set the NumberOfBooks field as I thought I might be able to get away with using the current function there. I&amp;#39;m open to using it as a default value; just thought the rule might give some flexibility.</description></item><item><title>Re: Using count() with secondary datasource</title><link>https://www.infopathdev.com:443/forums/thread/123166.aspx</link><pubDate>Thu, 02 Jul 2020 16:57:44 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:123166</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/123166.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=123166</wfw:commentRss><description>So - can you attach a copy of your form, or post a screenshot that shows the main data source structure, in a reply under the options tab? Is &amp;quot;my:Class&amp;quot; the repeating group? Is this count going in a field as a default or in a calculated value in the repeating table?</description></item><item><title>Using count() with secondary datasource</title><link>https://www.infopathdev.com:443/forums/thread/123163.aspx</link><pubDate>Thu, 02 Jul 2020 16:25:00 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:123163</guid><dc:creator>MemphisDev</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/123163.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=123163</wfw:commentRss><description>Hi!
I&amp;#39;m trying to use the count() function within a repeating table on a filtered secondary data source and struggling with counting within the current row. 

To avoid running a query each time a new row is added, as this seems to conflict with the previous row&amp;#39;s selections, I&amp;#39;ve loaded the data on form load (~680 records) and then use some drop-downs to build a filter that selects from the secondary datasource and works reliably from row to row.

I am able to count the first row correctly, however when I add a row, the count stops working and it becomes additive based on # of rows. (row A has 2 entries, row B has 1 entry, count becomes 3 on both)

I tried using current(), however, I can&amp;#39;t seem to get it to work in-place of getDOM() on the secondary data-source.
Essentially, I&amp;#39;m trying to do an error check so that the count of rows = number of filtered entries. 

If anyone has any suggestions on how to make this work or a better way to run this check, I&amp;#39;d greatly appreciate it.
Code is as follow:

count(xdXDocument:GetDOM(&amp;quot;BookStoreInventory&amp;quot;)/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:ISBN[../d:year = xdXDocument:get-DOM()/my:myFields/my:Year and ../d:term = xdXDocument:get-DOM()/my:myFields/my:Term and 
../d:EventID = xdXDocument:get-DOM()/my:myFields/my:ClassForm/my:ClassGroup/my:Class/my:TempFilter])</description></item></channel></rss>