Clarification:
you understand this is a view only.
Not like the DB view where you can add data.


David Gay sent the following on 12/12/2008 9:05 AM:
> Hi, all!  I've been looking into using view-entity entries to (in this
> instance) collect product information, and have some questions about
> "static conditionals".  But first, some context for discussion
> purposes.  ;-)
> 
> Let's say I'd like to have a Product view that includes the product's
> SKU as a column.  Here's a sample entitydef.xml (angle-brackets
> converted to square-brackets):
> 
> [view-entity entity-name="ProductFindViewEntity"
> package-name="com.emforium.inventory" title="Product-Find View
> Entity"]
>     [member-entity entity-alias="PR" entity-name="Product" /]
>     [member-entity entity-alias="SKU" entity-name="GoodIdentification" /]
>     [alias entity-alias="PR" name="productId" /]
>     [alias entity-alias="SKU" name="sku" field="idValue" /]
>     [alias entity-alias="SKU" name="skuTypeId"
> field="goodIdentificationTypeId" /]
>     [view-link entity-alias="PR" rel-entity-alias="SKU" rel-optional="true"]
>         [key-map field-name="productId" /]
>     [/view-link]
> [/view-entity]
> 
> Let's say I've also added two GoodIdentification rows for a product:
> 
> [GoodIdentification productId="ENCHILADAS"
> goodIdentificationTypeId="SKU" idValue="ENCH-SKU" /]
> [GoodIdentification productId="ENCHILADAS"
> goodIdentificationTypeId="MANUFACTURER_ID_NO" idValue="123-ENCH-456"
> /]
> 
> Now, a query for productId="ENCHILADAS" on this entity will yield two rows:
> 
> productId="ENCHILADAS", sku="ENCH-SKU", skuTypeId="SKU"
> productId="ENCHILADAS", sku="123-ENCH-456", skuTypeId="MANUFACTURER_ID_NO"
> 
> Obviously, I need a conditional (e.g. skuTypeId="SKU" OR
> skuTypeId=NULL), which I can do easily enough each place I do the
> query, but I'd prefer to add that to the entitydef.xml file, since
> it's the same in all cases (and avoids messy null-logic, etcetera).
> Perhaps something like this:
> 
>     ...
>     [view-link entity-alias="PR" rel-entity-alias="SKU" rel-optional="true"]
>         [key-map field-name="productId" /]
>         [where entity-alias="SKU" field="goodIdentificationTypeId"
> value="SKU" /]
>     [/view-link]
>     ...
> 
> So, my questions: Have I missed some already-available functionality?
> Is there a best-practice for this situation?  Has anyone else
> encountered this issue, and if so, how did you solve it?  Are there
> arguments against this sort of extension?
> 
> Thanks in advance,
> .Dave
> 
> 

Reply via email to