Expanding Entities and Export

Hi,

I have three tables:

Purchase, Product & ProductType

Every Purchase has a Product (telling me which product was purchased) and each Product has a ProductType (telling me of which type the product is).

I have a grid showing the purchases of a customer and in the columns I show the product name and product type name. By using $expand I can easily include the Product and ProductType entities.

Now I also want to use the Export function (to CSV and Excel). The problem is that the selected columns here behave differently compared to the selected columns of the grid. In my export code, I have defined $expand = Product,Product.ProductType (same as in the main query for the grid) and $select = PurchaseNo, Product.Name, Product.ProductType.Name

This causes an AmbigiousMatchException. As soon as I remove the Product.ProductType.Name from the $select, it works but of course the name of the product type is not shown then which is what I need.

Any idea why this works fine in the datagrid but not in the export method?

Thanks for your suggestions!

1 Like

Thanks! Just in this second, I discovered this as the reason when looking at some other export code generated by Radzen. The problem is simply because Product and ProductType both have a "Name" property and the export engine will not know how to differentiate. Using the "as" operator to assign a new name to the column for export indeed did the trick!

Thanks for your ultru-quick reply! :slight_smile: