Skip to content

GitHub Issue 898: SampleFinder: MVFK over MVTC with special characters result in bad grid#7474

Open
XingY wants to merge 6 commits intodevelopfrom
fb_mvtcMVFK
Open

GitHub Issue 898: SampleFinder: MVFK over MVTC with special characters result in bad grid#7474
XingY wants to merge 6 commits intodevelopfrom
fb_mvtcMVFK

Conversation

@XingY
Copy link
Contributor

@XingY XingY commented Mar 4, 2026

Rationale

Issue link

When a MultiChoice field contains options that contains double quote character, the field fails to display properly when queried as a multi-value foreign key, such as Ancestor columns for sample finder. This is due to GROUP_CONCAT escapes double quote with \", but MultiChoice.Array.from expects GoogleSheetMultiValue, which escapes quote with double quotes "".

This PR also contains package version update for Issue 897: Study dataset should not allow multivalue text choice as a third key

Related Pull Requests

Changes

  • Replace \" with "" for MultiChoice array {} value used by MultiValuedRenderContext so splitStringToValuesForImport can operates on them correctly.

@XingY XingY requested a review from labkey-matthewb March 4, 2026 22:24
{
String pgArrayStr = strVal.substring(1, strVal.length() - 1);
// pgArrayStr escapes double quote with \", but MultiChoice.Array.from expects GoogleSheetMultiValue, which escapes quote with double quotes ""
pgArrayStr = pgArrayStr.replace("\\\"", "\"\"");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not think of this case , needing to parse server-side (CAST mv AS TEXT).
I think it might be better to write a full parsePgArray() method, because if there is one character that is \-escaped there are more. E.g.

SELECT CAST(ARRAY[a,b,c] as VARCHAR)
FROM (VALUES ('a"', 'b\', 'c\"')) AS x (a, b, c)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could leave the {} in place and let MultiChoice.Parser detect them and use an alternate parser?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added parsePgArray method. I only know of double quote and backslash that needs special handling. Let me know if there are more that you know of.

@XingY XingY requested a review from labkey-matthewb March 5, 2026 20:28
@XingY XingY changed the title GitHub Issue 898: SampleFinder: MVFK over MVTC with special characters result in bad sql error GitHub Issue 898: SampleFinder: MVFK over MVTC with special characters result in bad grid Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants