Deepak

Thanks, that is exactly what I needed.  For any of those who need a Product
list with on hand quantities, this works a charm with Deepaks modification.

Skip

-----Original Message-----
From: Deepak Dixit [mailto:deepak.di...@hotwaxmedia.com]
Sent: Friday, November 15, 2013 9:58 PM
To: user@ofbiz.apache.org
Subject: Re: View Entity Question


Hi Skip,

Please try with rel-optional="true";

<view-link entity-alias="PR" rel-entity-alias="II" rel-optional="true>
    <key-map field-name="productId"/>
 </view-link>

Thanks & Regards
--
Deepak Dixit


On Nov 16, 2013, at 12:27 AM, Skip wrote:

> I have this view that gives the quantity on hand for requested products:
>
>    <view-entity entity-name="ProductInventoryItemAndFacilitySum"
>        package-name="org.ofbiz.product.product"
>        title="View entity joining Product and InventoryItem to allow
> queries for InventoryItem based on product attributes">
>        <member-entity entity-alias="PR" entity-name="Product"/>
>        <member-entity entity-alias="II" entity-name="InventoryItem"/>
>        <alias entity-alias="II" name="facilityId" group-by="true"/>
>        <alias entity-alias="PR" name="productId" group-by="true"/>
>        <alias entity-alias="PR" name="description" group-by="true"/>
>        <alias entity-alias="PR" name="brandName" group-by="true"/>
>        <alias entity-alias="PR" name="productName" group-by="true"/>
>        <alias entity-alias="PR" name="internalName" group-by="true"/>
>        <alias entity-alias="PR" name="normallyStocked" group-by="true"/>
>        <alias entity-alias="PR" name="isCatalogItem" group-by="true"/>
>        <alias entity-alias="PR" name="productTypeId" group-by="true"/>
>        <alias entity-alias="II" name="availableToPromiseTotal"
> function="sum"/>
>        <alias entity-alias="II" name="quantityOnHandTotal"
function="sum"/>
>        <view-link entity-alias="PR" rel-entity-alias="II">
>            <key-map field-name="productId"/>
>        </view-link>
>        <relation type="one" fk-name="PROD_INV_SUM_PROD"
> rel-entity-name="Product">
>          <key-map field-name="productId"/>
>        </relation>
>        <relation type="many" fk-name="PROD_INV_SUM_PRC"
> rel-entity-name="ProductPrice">
>          <key-map field-name="productId"/>
>        </relation>
>    </view-entity>
>
> However, if there is no InventoryItem record for the Product, there are no
> results.  I would like availableToPromiseTotal to return zero (or null) if
> there are no InventoryItems for the Product.  I can do this by making two
> queries, but it would be nice to get it in one.  Is there a way to say
that
> the InventoryItem is not required in the join?
>
> Skip
>


Reply via email to