cancel
Showing results for 
Search instead for 
Did you mean: 

MDK Queryoptions using Rule does not work

sopizaken
Participant
0 Kudos

Hi experts,

We have created an mdk project that displays a hierarchy of locations and equipments under those locations. However, we dont have a separate entity for the locations. We only have an entity for all the equipments and we just have fields to identify as to which location the equipment belongs to. Because of this, every time i read the entity, i get duplicate values for the locations.

That is why, i have created a rule to define a query option wherein the list will only get one equipment of that location. I have seen that the filter parameter that is being returned by the rule is correct, however the list still displays all the items. Would you know why the list doesn't seem to get the correct filter for this? Here's the custom rule i have written:

When i added an alert displaying the output, it correctly returns the unique filter parameters.

Appreciate any inputs you may have.
Thank you!

View Entire Topic
dhanikawick41
Participant

Hi @sopizaken

I think you do not need to return the entityset name if the rule is used as a query because you already define it in the Target. Your output variable should be as below.

let output = "$filter=";

I did a similar thing recently and what I returned was something as below and it worked totally fine.

return "$filter=TechnicalObject eq '" + technicalObject + "'&$orderby=OrderNumber desc";

Thanks.

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

Dhanika is correct, you should not return the Entity Set name in your query options rule.

sopizaken
Participant

Thanks dhanikawick41! That solved the issue 🙂