I think you mean "find" when you say "sort". (To "sort" means to arrange a set of records into a specified order.) Is that correct?
You want to find all Paid or Unpaid records in Bill for a specific property. Right?
There's no line in your script to specify criteria that will identify the property. You'll need a second set field step specifying the date for the "selected property". Exactly how that will work will depend on how you set up your layout so the user can select that property. This could be the current record on a property layout or a value selected in a global field formatted with a value list or some more sophisticated value selection tool....
Yes I meant find.
And yes that is correct. I did as you suggested and added another Set Field step in the script where it takes the property ID from the global field that is selected to display the property. This works well but I now have one more question.
If I have all records showing unsorted, what would I need to change to the script above to show all bills Paid/Unpaid for ALL properties. Is there a way in the same script to somehow exclude the Property ID global field when I want it for all properties?
IF the global property ID field is empty, doesn't it then find all properties with the specified "paid" or "unpaid" status?
No because a property is always selected in the dropdown menu, I am not sure of a way not to have one selected as the value list is based on the property ID.
The global field should start out empty. Just because you format it with a value list does not mean that it has to have a value. And you can add a button to clear it if you are using a value list format where it is not obvious to the user that you can put the focus in the field and clear it by pressing the back space. And your script can automatically clear this field after performing the find.
But a more important question is: If there's always a value in this field, what action on the part of the user is different when they want to see a list for all properties instead of just a selected property? We need to start from that context to either use a different script that does not specify the property ID in the find or pass a different script parameter to the same script that the script can use to determine whether or not to specify a property ID.
I was hoping to avoid the user having to do another step, like a clear button, as they wouldn't know when (or why) to press it with the way I have it setup.
what action on the part of the user is different
I'm not sure to be honest. I was thinking for the value list of having another value "All" that could be selected for the find to show all properties, but if the values are based on the field PropertyID then that won't be possible. Worst case I could create a custom value list with property ID's and All, but I would like to avoid that if possible.
I am not sure how script parameters work sorry. I'm happy to start the script from scratch. I may have made it more confusing than it needs to be.
My point here, is that FileMaker cannot read minds. There has to be some difference in your interface that you design into your system. It might be that you have a different button to click or it might be that this field is always empty until the user selects a value and then simply leaving the field empty produces the result that you need. It's your choice, but once you tell me that choice, we can then modify your script (if any modification is even needed) to work from that interface design.