Limit Secondary Data Connetion to Specific Number of Rows - InfoPath Dev
in

InfoPath Dev

Limit Secondary Data Connetion to Specific Number of Rows

Last post 06-17-2015 07:47 AM by chasquad. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 06-12-2015 11:49 AM

    Limit Secondary Data Connetion to Specific Number of Rows

    Hi

    I have InfoPath 2013 form that uses SharePoint Secondary Data Connection.  The data connection is sorted descending by date and filtered to show only approved items.  The form is being displayed in a SharePoint Online web page using the InfoPath Form Web Part.

    I don't want to show all approved items.  I just want to show the last 4 items.  This would be easy if it were not in SharePoint Online and had to be a InfoPath Web based form, but those are the requirements.  Sorry!

    Any help would be appreciated.

    Thanks!

  • 06-14-2015 11:01 PM In reply to

    Re: Limit Secondary Data Connetion to Specific Number of Rows

    You can add a formatting rule to the repeating row that hides the control; the key is the condition for the rule:

    count(preceding-sibling::my:group2) + 1 <= count(/my:myFields/my:group1/my:group2) - 4 

    *AND*

    count(/my:myFields/my:group1/my:group2) > 4

     

    Note: this assumes that you have a form with a stock data source root node of myFields and group1->group2 underneath it where group2 is repeating.

    You will need the change the fields to your form to make it work.

    Check out the attached sample.

    Patrick Halstead
    Project Manager at Qdabra
  • 06-16-2015 06:29 AM In reply to

    Re: Limit Secondary Data Connetion to Specific Number of Rows

    Thanks Patrick

    It's been a long time. 

    I've attached my form for reference.  It uses a secondary data connection.  I'm not sure if this works with those.  The xpath is /dfs:myFields/dfs:dataFields/d:SharePointListItem_RW

    thanks for your help!

  • 06-16-2015 07:42 AM In reply to

    Re: Limit Secondary Data Connetion to Specific Number of Rows

     Patrick's formula for your form would be (on a condition on the repeating d:SharePointListItem_RW group):

    count(preceding-sibling::d:SharePointListItem_RW) + 1 <= count(/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW) - 4

    *AND*

    count(/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW) > 4 

    Hilary Stoupa

  • 06-16-2015 08:21 AM In reply to

    Re: Limit Secondary Data Connetion to Specific Number of Rows

     It WORKS!

     Thank you both!

  • 06-17-2015 07:40 AM In reply to

    Re: Limit Secondary Data Connetion to Specific Number of Rows

     I just discovered an issue.

     So, I have this secondary data connection set to sort by date showing the last created entries first.  Without the conditional formatting rules applied, new entries appear, but I get all of them!  With the conditional formatting rules applied, new entries do not appear, but I get the row limits that I wanted.

    Really what I need is for the last 6 entries to be posted to be displayed.  But with the rules applied, I guess I get 6 entries, but not necessarily the last 6 to be posted.

    Help!

     

    Thanks!

  • 06-17-2015 07:47 AM In reply to

    Re: Limit Secondary Data Connetion to Specific Number of Rows

     So, on Form Load I have the Status field of the query of the secondary data connection being set to "approved" so that I only bring in approved posts.  Then I have the secondary data connection being queried.  The secondary data connection is set up to sort descending on Announcement Start Date field.

    Then on the repeating table properties, I have added the formatting rule

    count(preceding-sibling::d:SharePointListItem_RW) + 1 <= count(/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW) - 6

    AND

    count(/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW) > 6

Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.