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