Custom Function: Combine data values into a list

This function creates a list that will store all of the values of a selected field. The function accepts four arguments:

  1. The field that will be concatenated.
  2. A delimiter character to separate items in the list.
  3. An identifier for the list, to allow for using multiple aggregations on the same report.
  4. One of the following actions:
    • "clear" - Clear the list (for concatenating within groups)
    • "add" - Add values to the list
    • "get" - Display the full list

Arguments (Min - Max): 4 - 4


AggConcat({Category.Field},"; ","ListName","action")

Since this function is, ultimately, being used to collect and concatenate data values, it should be instantiated within 3 sections of the report:

  • In the section where the concatenated data will be displayed, the "get" action of the function will be used. This is typically instantiated within a report or group footer section.
    • AggConcat({Table.Field},'deliminator','listname','get')
  • In the section where data values will be cycled through in order to be added to the compiling list, the "add" action will be used. This is typically instantiated in the detail section, which is the section where new data values will be available.
    • AggConcat({Table.Field},'deliminator','listname','add')
  • Finally, the "clear" action will be instantiated in the header section in order to to reset the list.
    • AggConcat({Table.Field},'deliminator','listname','clear')




string input = System.Convert.ToString(args[0]);
string delim = System.Convert.ToString(args[1]);
string list = System.Convert.ToString(args[2]);
string action = System.Convert.ToString(args[3]);

  case "clear":
    sessionInfo.SetStoredValue(list, null);
    return "";
  case "get":
    return sessionInfo.GetStoredValue(list).ToString();
  case "add":
    if (sessionInfo.GetStoredValue(list) == null)
      sessionInfo.SetStoredValue(list, input);
      sessionInfo.SetStoredValue(list, sessionInfo.GetStoredValue(list) + delim + input);
      return sessionInfo.GetStoredValue(list).ToString();
    return "Error: '" + action + "' was not understood. Valid actions are \"clear,\" \"get,\" or \"add.\"";

Hidden Article Information

Article Author
created 2016-01-22 21:24:52 UTC
updated 2019-06-06 21:31:26 UTC

functions, concatenate, example, custom function, agg, concat, aggconcat, aggconcatenate, bucket,
Have more questions? Submit a request