How to list quotes asc?

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

How to list quotes asc?

CaseT
Hi,

How would I go about listing our quotes in ascending order. The code in
QuoteForms.xml calls performFind (see code below).
It basically gets all quotes and lists them by quoteId in descending order.
Is there a simple tag I can add to change that to asc order? I couldn't find
any examples.

Thanks,

  <actions>
            <service service-name="performFind" result-map-name="result"
result-map-list-name="listIt">
                <field-map field-name="inputFields" env-name="parameters"/>
                <field-map field-name="entityName" value="Quote"/>
            </service>
        </actions>

---
Case Torres
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: How to list quotes asc?

Scott Gray
Something like this should work:
<field-map field-name="orderBy" value="quoteId DESC"/>
you can add additional fields to sort by using "|" as a separator, for
example:
<field-map field-name="orderBy" value="validFromDate DESC | validThruDate
ASC"/>

Regards
Scott

2008/4/23 Case Torres <[hidden email]>:

> Hi,
>
> How would I go about listing our quotes in ascending order. The code in
> QuoteForms.xml calls performFind (see code below).
> It basically gets all quotes and lists them by quoteId in descending
> order.
> Is there a simple tag I can add to change that to asc order? I couldn't
> find
> any examples.
>
> Thanks,
>
>        <actions>
>            <service service-name="performFind" result-map-name="result"
> result-map-list-name="listIt">
>                <field-map field-name="inputFields" env-name="parameters"/>
>                <field-map field-name="entityName" value="Quote"/>
>            </service>
>        </actions>
>
> ---
> Case Torres
> [hidden email]
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: How to list quotes asc?

Jacopo Cappellato-3
Scott is right; however the preferred (db independent) syntax is:

> <field-map field-name="orderBy" value="-quoteId"/>

I.e. you should use a "-" as a prefix to specify the DESC order
and a "+" prefix for an ASC order

Jacopo


On Apr 23, 2008, at 9:22 AM, Scott Gray wrote:

> Something like this should work:
> <field-map field-name="orderBy" value="quoteId DESC"/>
> you can add additional fields to sort by using "|" as a separator, for
> example:
> <field-map field-name="orderBy" value="validFromDate DESC |  
> validThruDate
> ASC"/>
>
> Regards
> Scott
>
> 2008/4/23 Case Torres <[hidden email]>:
>
>> Hi,
>>
>> How would I go about listing our quotes in ascending order. The  
>> code in
>> QuoteForms.xml calls performFind (see code below).
>> It basically gets all quotes and lists them by quoteId in descending
>> order.
>> Is there a simple tag I can add to change that to asc order? I  
>> couldn't
>> find
>> any examples.
>>
>> Thanks,
>>
>>       <actions>
>>           <service service-name="performFind" result-map-
>> name="result"
>> result-map-list-name="listIt">
>>               <field-map field-name="inputFields" env-
>> name="parameters"/>
>>               <field-map field-name="entityName" value="Quote"/>
>>           </service>
>>       </actions>
>>
>> ---
>> Case Torres
>> [hidden email]
>>
>>
>>

Reply | Threaded
Open this post in threaded view
|

Re: How to list quotes asc?

Scott Gray
Hi Jacopo

Much as I hate to argue with you, I think both approaches evaluate to the
same result.  Have a look at OrderByItem.java, the parse() method, line 66
in trunk.

Regards
Scott

2008/4/23 Jacopo Cappellato <[hidden email]>:

> Scott is right; however the preferred (db independent) syntax is:
>
>  <field-map field-name="orderBy" value="-quoteId"/>
> >
>
> I.e. you should use a "-" as a prefix to specify the DESC order
> and a "+" prefix for an ASC order
>
> Jacopo
>
>
>
> On Apr 23, 2008, at 9:22 AM, Scott Gray wrote:
>
>  Something like this should work:
> > <field-map field-name="orderBy" value="quoteId DESC"/>
> > you can add additional fields to sort by using "|" as a separator, for
> > example:
> > <field-map field-name="orderBy" value="validFromDate DESC |
> > validThruDate
> > ASC"/>
> >
> > Regards
> > Scott
> >
> > 2008/4/23 Case Torres <[hidden email]>:
> >
> >  Hi,
> > >
> > > How would I go about listing our quotes in ascending order. The code
> > > in
> > > QuoteForms.xml calls performFind (see code below).
> > > It basically gets all quotes and lists them by quoteId in descending
> > > order.
> > > Is there a simple tag I can add to change that to asc order? I
> > > couldn't
> > > find
> > > any examples.
> > >
> > > Thanks,
> > >
> > >      <actions>
> > >          <service service-name="performFind" result-map-name="result"
> > > result-map-list-name="listIt">
> > >              <field-map field-name="inputFields"
> > > env-name="parameters"/>
> > >              <field-map field-name="entityName" value="Quote"/>
> > >          </service>
> > >      </actions>
> > >
> > > ---
> > > Case Torres
> > > [hidden email]
> > >
> > >
> > >
> > >
>
Reply | Threaded
Open this post in threaded view
|

Re: How to list quotes asc?

Jacopo Cappellato-3
yeah, you are right Scott!
I still prefer the +- syntax over the ASC/DESC (because it is more  
clearly a different syntax from the SQL one)  but it is definitely a  
matter of personal preference.
Thanks for pointing this out.

Jacopo

On Apr 23, 2008, at 9:48 AM, Scott Gray wrote:

> Hi Jacopo
>
> Much as I hate to argue with you, I think both approaches evaluate  
> to the
> same result.  Have a look at OrderByItem.java, the parse() method,  
> line 66
> in trunk.
>
> Regards
> Scott
>
> 2008/4/23 Jacopo Cappellato <[hidden email]>:
>
>> Scott is right; however the preferred (db independent) syntax is:
>>
>> <field-map field-name="orderBy" value="-quoteId"/>
>>>
>>
>> I.e. you should use a "-" as a prefix to specify the DESC order
>> and a "+" prefix for an ASC order
>>
>> Jacopo
>>
>>
>>
>> On Apr 23, 2008, at 9:22 AM, Scott Gray wrote:
>>
>> Something like this should work:
>>> <field-map field-name="orderBy" value="quoteId DESC"/>
>>> you can add additional fields to sort by using "|" as a separator,  
>>> for
>>> example:
>>> <field-map field-name="orderBy" value="validFromDate DESC |
>>> validThruDate
>>> ASC"/>
>>>
>>> Regards
>>> Scott
>>>
>>> 2008/4/23 Case Torres <[hidden email]>:
>>>
>>> Hi,
>>>>
>>>> How would I go about listing our quotes in ascending order. The  
>>>> code
>>>> in
>>>> QuoteForms.xml calls performFind (see code below).
>>>> It basically gets all quotes and lists them by quoteId in  
>>>> descending
>>>> order.
>>>> Is there a simple tag I can add to change that to asc order? I
>>>> couldn't
>>>> find
>>>> any examples.
>>>>
>>>> Thanks,
>>>>
>>>>     <actions>
>>>>         <service service-name="performFind" result-map-
>>>> name="result"
>>>> result-map-list-name="listIt">
>>>>             <field-map field-name="inputFields"
>>>> env-name="parameters"/>
>>>>             <field-map field-name="entityName" value="Quote"/>
>>>>         </service>
>>>>     </actions>
>>>>
>>>> ---
>>>> Case Torres
>>>> [hidden email]
>>>>
>>>>
>>>>
>>>>
>>