Skip to content

#grouparrayby Ignores Custom SplitGroupChar Setting #311

@Sangeetha-Murugesan

Description

@Sangeetha-Murugesan

Summary
The JustContext.SplitGroupChar setting is not honored in the #grouparrayby transformer. Even if a custom split character (like |) is assigned to context.SplitGroupChar, the grouping logic still uses : internally, causing unexpected behavior when grouping by fields that contain : — such as DateTime strings.

Steps to Reproduce

Use a JSON input array with a fromDate field containing a full ISO timestamp, e.g. "2022-01-01T00:00:00".

Set a custom group split character in C#:

var context = new JustContext();
context.GroupBySplitChar = "|";

Use the following rule:

{
  "transformationRules": {
    "Result": "#grouparrayby($,payrollUnit|fromDate,all)"
  }
}

Run transformation with this context and input.

Expected Result
Grouping should succeed using payrollUnit and fromDate as the group key, preserving the full fromDate value (e.g., "2022-01-01T00:00:00").

Actual Result
The fromDate value is truncated (e.g., becomes "2022-01-01T00").

Root Cause
In the JUST.NET source code (likely in Utilities.cs), the group key string is split using a hardcoded colon (:), rather than using context.SplitGroupChar.

Suggested Fix
Update the relevant grouping logic to use context.SplitGroupChar instead of ':'. This will allow safe grouping on fields like DateTime that contain : and aligns with the design of JustContext.``

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions