Using Count() function with a filter - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Using Count() function with a filter

Last post 09-21-2015 06:23 AM by Sheila. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 09-17-2015 09:20 AM

    • Sheila
    • Not Ranked
      Female
    • Joined on 10-08-2013
    • Boca Raton, FL
    • Posts 23

    Using Count() function with a filter

     I am sure that this is probably SO easy but I'm not a programmer and always have problems with syntax in a formula.

    (all is based on SharePoint Online and InfoPath 2013) 

    I have a field in a form with a display name of  "Detention Date Requested" (actual name: "DetentionDate").

    I want the user to put in the Detention Date Requested, click on a button called "Check if Date is Available" where the button actually causes the action of going out to the list "Detention List 2015-2015", which I already have the data connection, counting the dates that match the date the user just entered and placing that number into a box where it now looks to see the value and if =25 gives a validation error that there is no more space available on this day.

    So in essence (bad syntax here I know), when the button is clicked the formula is something like this:

    count (DetentionDate)where(Detention Date Requested)=(DetentionDate) and return the number

  • 09-17-2015 10:21 AM In reply to

    Re: Using Count() function with a filter

    If you set the query field in your Detention List data connection to the selected date, then execute the query, you should get back just the rows that match. No need to filter in your count formula. :)
    Hilary Stoupa

  • 09-17-2015 10:44 AM In reply to

    • Sheila
    • Not Ranked
      Female
    • Joined on 10-08-2013
    • Boca Raton, FL
    • Posts 23

    Re: Using Count() function with a filter

     That returns each item but not a count. I only need to know how many records/list items currently exist with that date.

  • 09-17-2015 11:26 AM In reply to

    Re: Using Count() function with a filter

    Right, that returns the items that match. Then you use the count function to count them....
    Hilary Stoupa

  • 09-21-2015 06:23 AM In reply to

    • Sheila
    • Not Ranked
      Female
    • Joined on 10-08-2013
    • Boca Raton, FL
    • Posts 23

    Re: Using Count() function with a filter

     Thank you Hillary. You helped me resolve the issue by just adding the COUNT() in the formula, but also telling me to add the query. You're the best!

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