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. Optional: 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")


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 2017-07-17 16:44:42 UTC

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