When using setdefault() in CML to automatically select a child product and assign it a calculated quantity, the quantity assignment silently fails if the target product is declared before the source product in the bundle sequence.
The CML constraint solver evaluates variables in declaration order across the whole bundle. Group boundaries do not isolate evaluation scope. If the target product appears earlier in the sequence than the source product, the solver processes the target before the source value has resolved, leaving setdefault() with nothing to evaluate against. The assignment fails without throwing an error.
Symptoms:
- setdefault(sourceProduct > 0, targetProduct == calculatedValue) does not update the target product's quantity
- Auto-selection works when used alone but stops working after a quantity assignment is added
- The same logic works correctly when the target product is declared after the source product
Example configuration:
- Group 1 contains Child1 and Child2
- Group 3 contains Antivirus
- The following CML works for auto-selection alone:
setdefault(child1[Child1] > 0, antivirus[Antivirus]);
- Adding a calculated quantity assignment fails when Antivirus precedes Child1 in the bundle sequence:
int child2Qty = child1[Child1] * 4;
setdefault(child1[Child1] > 0, antivirus[Antivirus] == child2Qty);
This is confirmed expected behavior, verified by the CML product team.
Reorder the child products so the target product appears after the source product in the sequence. This ensures the solver processes the source value before evaluating the target assignment.
Retest the CML constraint to confirm the quantity assignment updates correctly.
005390615

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.