Skip to content

[28.x] Fix MLLM decimal parsing for locale-formatted invoices#8833

Merged
Groenbech96 merged 1 commit into
releases/28.xfrom
magnushar/backport-mllm-decimal-28_x
Jun 29, 2026
Merged

[28.x] Fix MLLM decimal parsing for locale-formatted invoices#8833
Groenbech96 merged 1 commit into
releases/28.xfrom
magnushar/backport-mllm-decimal-28_x

Conversation

@Groenbech96

@Groenbech96 Groenbech96 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Backport of #8310 to releases/28.x.

Cherry-picks commit bbad0a8.

Summary

  • Root cause: The UBL schema template used string "0" placeholders for numeric fields, causing the MLLM to return locale-formatted strings (e.g. Swedish "2,34") instead of JSON numbers. AL's AsDecimal() then stripped the comma, turning "2,34" into 234.
  • Fix 1 (ubl_example.json): Changed all numeric string "0" placeholders to 0 (JSON numbers).
  • Fix 2 (EDocMLLMExtraction-SystemPrompt.md): Added explicit rule requiring XML decimal format.
  • Fix 3 (EDocMLLMSchemaHelper.Codeunit.al): Replaced AsDecimal() with Evaluate(…, AsText(), 9) in GetDecimal() for locale-independent parsing.

Fixes AB#640596

## Summary

- **Root cause**: The UBL schema template used string `"0"` placeholders
for numeric fields, causing the MLLM to return locale-formatted strings
(e.g. Swedish `"2,34"`) instead of JSON numbers. AL's `AsDecimal()` then
stripped the comma, turning `"2,34"` into `234`.
- **Fix 1** (`ubl_example.json`): Changed all numeric string `"0"`
placeholders to `0` (JSON numbers), teaching the model to return proper
numeric values.
- **Fix 2** (`EDocMLLMExtraction-SystemPrompt.md`): Added explicit rule
requiring XML decimal format (period as decimal separator, no thousands
separators).
- **Fix 3** (`EDocMLLMSchemaHelper.Codeunit.al`): Replaced `AsDecimal()`
with `Evaluate(…, AsText(), 9)` in `GetDecimal()`, which parses
XML-format decimals locale-independently — consistent with how
`GetDate()` already handles date strings.

[AB#640342](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/640342)

---------

Co-authored-by: Magnus Hartvig Grønbech <magnushar@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit bbad0a8)
@Groenbech96 Groenbech96 requested review from a team June 26, 2026 07:23
@Groenbech96 Groenbech96 requested a review from a team as a code owner June 26, 2026 07:23
@github-actions github-actions Bot added the AL: Apps (W1) Add-on apps for W1 label Jun 26, 2026
@github-actions github-actions Bot added this to the Version 28.3 milestone Jun 26, 2026
@Groenbech96 Groenbech96 merged commit e012b1a into releases/28.x Jun 29, 2026
34 checks passed
@Groenbech96 Groenbech96 deleted the magnushar/backport-mllm-decimal-28_x branch June 29, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants