"Is there a simple way to determine and reflect the plural form of the Sort List Key in a sorted/break state?"
Use the getSummary function
Hi Phil. Thanks for the quick reply ( it's your way, I know!).
I see how the GetSummary function is well-suited for my particular need but I have spent hours attempting to implement it with results varying from a recursive loop to just plain not working.
DESIRED RESULT in Browse Mode (list format)
After sorting the found set, records with like Real Property categories are grouped. A sub-summary part is situated before each sorted grouping and reflects the group's Real Property category, expressed in singular or plural form, as the case may be.
Here's my set-up:
List format with a sub-summary part containing a Merge Field for c_Sort List Key (the break field?)
Sort Selection //text,global,auto-enter calc,replace existing value displayed in pop-up menu form with value list related to Real Property. Expression: If ( IsEmpty ( Self ) ; "Category" ; Self )
c_Sort List Key //calc field with logic to determine 1) type of real property, and 2) if instances of that property category should be displayed as singular or plural. (See expression below)
c_breakSum //calc field with the expression: GetSummary ( s_Count ; Sort Selection )
s_Count //summary field which counts record IDs for the found set
LOGIC CALCULATION for FIELD c_Sort List Key
Let ( [
$sortSel = GetField ( Sort Selection ) ; // from a pop-up menu list of values
$breakSum = c_BreakSum ; // field with GetSummary function
$sortSelPlural = If ( $breakSum = 1 ; $sortSel ; $sortSel & "s" ) ] ; // adds an "s" for plural cases
$sortSel = "Mobile Home Park" and $breakSum = 1 ; $sortSel ; //Mobile Home Park
$sortSel = "Mobile Home Park" and $breakSum ≠ 1 ; $sortSelPlural ; //Mobile Home Parks
$sortSel = "Mobile Home" and $breakSum = 1 ; $sortSel ;
$sortSel = "Mobile Home" and $breakSum ≠ 1 ; $sortSelPlural ;
$sortSel = "Warehouse" and $breakSum = 1 ; $sortSel ;
$sortSel = "Warehouse" and $breakSum ≠ 1 ; $sortSelPlural ;
$sortSel = "RV Park" and $breakSum = 1 ; $sortSel ;
$sortSel = "RV Park" and $breakSum ≠ 1 ; $sortSelPlural ;
1. Is the Sort Selection field the break field (the one in the sub-summary part) or is it c_Sort List Key?
2. When I use c_Sort List Key as the break field in the GetSummary function the solution goes into infinite recursion.
I haven't used this function before so I am kind of lost on this one!
Which field do you sort on to get the sub summary part to appear?
That's the field to specify as the break field in the getsummary function.
This line looks incorrect:
$sortSel = GetField ( Sort Selection ) ;
Seems like it should be:
$sortSel = Sort Selection ;
PhilModJunk already pointed out that the usage of GetField() isn't correct here.
As to your calculation: you can simplify it like this if every plural form can be formed by appending an "s":
Sort Selection & If ( BreakSum ≠ 1 ; "s" )
There is no need to use Let() if you do not have complex expressions or reference the same field multiple times. (But if you do use Let(), there is no need to create prefixed variables, i.e. $variable.)
If you want to limit the conditional plural form to specific words, try
Let ( [
pluralWords = List ( "Mobile Home Park" ; "Mobile Home" ; Warehouse" ; "RV Park" ) ;
selection = Sort Selection ;
not IsEmpty ( FilterValues ( selection ; pluralWords ) ) and BreakSum ≠ 1 ;