Skip to content

Association navigation expression: missing target entity and extra spaces #38

@engalar

Description

@engalar

Bug

When using association navigation in microflow expressions, mxcli generates expressions with two issues:

1. Missing target entity qualifier

Generated:

$Order / Module.Order_Customer / Name

Expected (valid Mendix expression):

$Order/Module.Order_Customer/Module.Customer/Name

The Mendix expression engine requires the full path: $var/Association/TargetEntity/Attribute. mxcli omits the target entity name, causing CE0117 ("Error(s) in expression").

Since the association definition already contains the target entity, mxcli should auto-resolve it during code generation.

2. Extra spaces around path separators

Generated:

$Order / Module.Order_Customer / Name

Expected:

$Order/Module.Order_Customer/Module.Customer/Name

The spaces around / are cosmetic but may also contribute to Mendix expression parser failures.

Root cause

The MDL-to-Mendix expression translator does not:

  1. Look up the association's target entity to insert it into the path
  2. Strip whitespace around / path separators

Repro

CREATE PERSISTENT ENTITY MyModule.Customer (Name: String(200));
CREATE PERSISTENT ENTITY MyModule.Order (OrderNumber: String(50));
CREATE ASSOCIATION MyModule.Order_Customer
  FROM MyModule.Order TO MyModule.Customer TYPE Reference;

CREATE MICROFLOW MyModule.TestNav()
RETURNS String AS $Result
BEGIN
  RETRIEVE $Order FROM MyModule.Order LIMIT 1;
  DECLARE $CustName String = $Order/MyModule.Order_Customer/Name;
  RETURN $CustName;
END;
/

DESCRIBE MICROFLOW output shows $Order / MyModule.Order_Customer / Name — fails CE0117 on mx check.

Expected fix

mxcli should generate: $Order/MyModule.Order_Customer/MyModule.Customer/Name

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