Re: How to return distinct values using findByAnd

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: How to return distinct values using findByAnd

aswath narayana
On Tue, Sep 15, 2009 at 2:25 PM, aswath narayana <[hidden email]
> wrote:

> Hello,
> There is a bug in orderHistory.ftl.
> In the line 60, that is as follows
>               <#assign invoices = delegator.findByAnd("OrderItemBilling",
> Static["org.ofbiz.base.util.UtilMisc"].toMap("orderId",
> "${orderHeader.orderId}"))>
>               <#if invoices?has_content>
>                  <#list invoices as invoice>
>                      <a
> href="<@ofbizUrl>invoice.pdf?invoiceId=${invoice.invoiceId}</@ofbizUrl>"
> class="buttontext">(${invoice.invoiceId} PDF) </a>
>                  </#list>
>               <#else>
>               </#if>
>
> Here, in the orderhistory page, there are many invoice links displayed (all
> point to the same invoice).
> The sample data in my database is as follows, and hence displays 6 invoices
> for the same orderid in the orderhistory page as per the above
> delegator.findByAnd.
> orderid             seqid     invoiceid           issuanceid   quantity
> amount
> WSCO10000     00001     CI1      00001     10012        6
> 38.4
> WSCO10000     00001     CI1     00006     10013         5              38.4
>
> WSCO10000     00002     CI1     00011     10014         1
> 59.99
> WSCO10000     00005     CI1     00013     10017         1
> 59.99
> WSCO10000     00003     CI1     00015     10015         1              1.99
>
> WSCO10000     00004     CI1     00017     10016         1              1.99
>
>
> In the delegate.findByAnd, I need to get only the distinct rows based on
> orderid and invoiceid.   How can it be done?
>
> Thanks a lot
> -Aswath
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: How to return distinct values using findByAnd

skpradeepkumar
Hi,

  You can use : EntityUtil.getFieldListFromEntityList()


On Tue, Sep 15, 2009 at 2:45 PM, aswath narayana <[hidden email]
> wrote:

> On Tue, Sep 15, 2009 at 2:25 PM, aswath narayana <
> [hidden email]
> > wrote:
>
> > Hello,
> > There is a bug in orderHistory.ftl.
> > In the line 60, that is as follows
> >               <#assign invoices = delegator.findByAnd("OrderItemBilling",
> > Static["org.ofbiz.base.util.UtilMisc"].toMap("orderId",
> > "${orderHeader.orderId}"))>
> >               <#if invoices?has_content>
> >                  <#list invoices as invoice>
> >                      <a
> > href="<@ofbizUrl>invoice.pdf?invoiceId=${invoice.invoiceId}</@ofbizUrl>"
> > class="buttontext">(${invoice.invoiceId} PDF) </a>
> >                  </#list>
> >               <#else>
> >               </#if>
> >
> > Here, in the orderhistory page, there are many invoice links displayed
> (all
> > point to the same invoice).
> > The sample data in my database is as follows, and hence displays 6
> invoices
> > for the same orderid in the orderhistory page as per the above
> > delegator.findByAnd.
> > orderid             seqid     invoiceid           issuanceid   quantity
> > amount
> > WSCO10000     00001     CI1      00001     10012        6
> > 38.4
> > WSCO10000     00001     CI1     00006     10013         5
>  38.4
> >
> > WSCO10000     00002     CI1     00011     10014         1
> > 59.99
> > WSCO10000     00005     CI1     00013     10017         1
> > 59.99
> > WSCO10000     00003     CI1     00015     10015         1
>  1.99
> >
> > WSCO10000     00004     CI1     00017     10016         1
>  1.99
> >
> >
> > In the delegate.findByAnd, I need to get only the distinct rows based on
> > orderid and invoiceid.   How can it be done?
> >
> > Thanks a lot
> > -Aswath
> >
> >
> >
>



--
With regards,
S K Pradeep kumar
Reply | Threaded
Open this post in threaded view
|

Re: How to return distinct values using findByAnd

aswath narayana
I was thinking about something that can done with EntityCondition.  This
worked for me for now. Thanks Pradeep.
I will submit the patch.

On Tue, Sep 15, 2009 at 9:34 PM, S K Pradeep Kumar <
[hidden email]> wrote:

> Hi,
>
>   You can use : EntityUtil.getFieldListFromEntityList()
>
>
>
> On Tue, Sep 15, 2009 at 2:45 PM, aswath narayana <
> [hidden email]> wrote:
>
>> On Tue, Sep 15, 2009 at 2:25 PM, aswath narayana <
>> [hidden email]
>> > wrote:
>>
>> > Hello,
>> > There is a bug in orderHistory.ftl.
>> > In the line 60, that is as follows
>> >               <#assign invoices =
>> delegator.findByAnd("OrderItemBilling",
>> > Static["org.ofbiz.base.util.UtilMisc"].toMap("orderId",
>> > "${orderHeader.orderId}"))>
>> >               <#if invoices?has_content>
>> >                  <#list invoices as invoice>
>> >                      <a
>> > href="<@ofbizUrl>invoice.pdf?invoiceId=${invoice.invoiceId}</@ofbizUrl>"
>> > class="buttontext">(${invoice.invoiceId} PDF) </a>
>> >                  </#list>
>> >               <#else>
>> >               </#if>
>> >
>> > Here, in the orderhistory page, there are many invoice links displayed
>> (all
>> > point to the same invoice).
>> > The sample data in my database is as follows, and hence displays 6
>> invoices
>> > for the same orderid in the orderhistory page as per the above
>> > delegator.findByAnd.
>> > orderid             seqid     invoiceid           issuanceid   quantity
>> > amount
>> > WSCO10000     00001     CI1      00001     10012        6
>> > 38.4
>> > WSCO10000     00001     CI1     00006     10013         5
>>  38.4
>> >
>> > WSCO10000     00002     CI1     00011     10014         1
>> > 59.99
>> > WSCO10000     00005     CI1     00013     10017         1
>> > 59.99
>> > WSCO10000     00003     CI1     00015     10015         1
>>  1.99
>> >
>> > WSCO10000     00004     CI1     00017     10016         1
>>  1.99
>> >
>> >
>> > In the delegate.findByAnd, I need to get only the distinct rows based on
>> > orderid and invoiceid.   How can it be done?
>> >
>> > Thanks a lot
>> > -Aswath
>> >
>> >
>> >
>>
>
>
>
> --
> With regards,
> S K Pradeep kumar
>
>