Group break on Expression using script


I would like my group to break on an "expression" rather than directly on a data field. However my expression is complex and I'd like to use a script if possible rather the IIF statement.

As a simple test I've created a function in the "code" tab.

function GetCollatedGrouping: Variant;
begin
// This will become a complicated if-else function
// but for testing it is very simple
Result := <MyData."RecordNo">;
end;

However if I set the grouping to "Expression" and enter [GetCollatedGrouping], on previewing a "Invalid Variant Operation" error is given.

If I set the grouping back to being directly on the field and add a text MEMO to my form and enter [GetCollatedGrouping] as the expression, it correctly shows the RecordNo from the data set - so it seems FR can use this and I'm unsure why the grouping system can't.

So my question is, how can I use scripts within grouping expressions to be able to handle more complicated groupings and collation rules? (Please don't tell me to use IIF, I know this works but is insufficient for my needs).

Any advice would be appreciated.


Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.