Note that there are some explanatory texts on larger screens.

plurals
  1. POVb.net 2010 Reading sub properties of an object in reportViewer
    primarykey
    data
    text
    <p>I am creating some reports using object datasources.</p> <p>I have the following scenario:</p> <p>in my software the user can create a list of products specifying a <em>code</em>, the <em>product name</em>, the <em>price</em> and the <em>vat rate</em> (this last two attributes will be used as suggestions when the user will place the product inside an order).</p> <p>When a user creates an order he can place products within it by specifying for each product the quantity and he can also override the suggested price and the vat rate.</p> <p>So basically i have two models to represent the products: </p> <ul> <li><strong>ProductModel</strong> (used to define product name, product code and the default suggestion for price and vat rate)</li> <li><strong>OrderProductModel</strong> (used to place products within an order, specify the quantity and override the default product suggestion for price and vat number)</li> </ul> <p><strong>ProductModel</strong>:</p> <ul> <li>id</li> <li>code</li> <li>name</li> <li>price</li> <li>vat</li> </ul> <p><strong>OrderProductModel</strong>:</p> <ul> <li>id</li> <li>order (reference to an OrderModel object)</li> <li>product (reference to a ProductModel to read the code and the name and the suggestions for price and vat rate)</li> <li>quantity</li> <li>price</li> <li>vat</li> </ul> <p>Now what I need to do with my report is to fill a table of OrderProduct objects and show the following informations for each product:</p> <ul> <li>code (orderProduct.product.code)</li> <li>name (orderProduct.product.name)</li> <li>price (orderProduct.price)</li> <li>quantity (orderProduct.quantity)</li> </ul> <p>(suppose orderProduct is an instance of OrderProductModel)</p> <p>Now the question is "<strong>how to define the report rule to access to code and name?</strong>"...</p> <p>I am using visual studio 2010 and by reading here: <a href="http://www.gotreportviewer.com/objectdatasources/index.html" rel="nofollow">http://www.gotreportviewer.com/objectdatasources/index.html</a> they says that the syntax: <code>=Fields!Object.Value.attribute</code> no longer works...</p> <p>I tought i could solve the problem by adding to the OrderProductModel some properties that will read the properties of the related ProductModel instance. But i'm sure there are better way that does not break the model...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload