Untitled

 avatar
unknown
java
5 months ago
1.0 kB
3
Indexable
for (ConstraintGroup constraintGroup : ConstraintGroups) {
    // Build the XPath query to retrieve associated OptionValues
    String xPathQuery = String.format("//%s[%s='%s']", 
                                      "MyFirstModule.OptionValues", 
                                      "MyFirstModule.ConstraintGroup_OptionValues",  // Replace with correct association name
                                      constraintGroup.getMendixObject().getId().toLong());

    // Execute the XPath query
    List<IMendixObject> associatedOptionValues = Core.retrieveXPathQuery(
        getContext(),
        xPathQuery
    );

    // Initialize OptionValues from the IMendixObject list
    Set<String> optionValueNames = new HashSet<>();
    for (IMendixObject optionValueObj : associatedOptionValues) {
        OptionValues optionValue = OptionValues.initialize(getContext(), optionValueObj);
        optionValueNames.add(optionValue.getName());  // Or optionValue.getId()
    }

    constraintSets.add(optionValueNames);
}
Editor is loading...
Leave a Comment