Hi all,
I am stumped... I need to iterate through a list to find the the first entry given a set of parameters in a simple-method, but how do I escape from the iteration after having found the entry? I know that in groovy I can do a while loop and if I have found the entry I can issue a 'break; and close the iteration. But how do I do this in the interation in a simple-method? Regards, Pierre |
Hi Pierre,
I tried it before I could not find any <break> or <continue> in miniland iterator. But we can use <return/> statement to come out of the simple method. thanks prasath rajan 9442369696 On Wed, Jun 22, 2011 at 2:34 PM, Pierre Smits <[hidden email]>wrote: > Hi all, > > I am stumped... I need to iterate through a list to find the the first > entry > given a set of parameters in a simple-method, but how do I escape from the > iteration after having found the entry? > > I know that in groovy I can do a while loop and if I have found the entry I > can issue a 'break; and close the iteration. But how do I do this in the > interation in a simple-method? > > Regards, > > Pierre >
prasath rajan
9442369696
|
Thanks for the quick reply.
But wouldn't the <return /> end the entire simple method? In stead of just the section of code that has the iteration? Regards, Pierre 2011/6/22 prasanth r <[hidden email]> > Hi Pierre, > > I tried it before I could not find any <break> or <continue> in miniland > iterator. > > But we can use <return/> statement to come out of the simple method. > > thanks > prasath rajan > 9442369696 > > On Wed, Jun 22, 2011 at 2:34 PM, Pierre Smits <[hidden email] > >wrote: > > > Hi all, > > > > I am stumped... I need to iterate through a list to find the the first > > entry > > given a set of parameters in a simple-method, but how do I escape from > the > > iteration after having found the entry? > > > > I know that in groovy I can do a while loop and if I have found the entry > I > > can issue a 'break; and close the iteration. But how do I do this in the > > interation in a simple-method? > > > > Regards, > > > > Pierre > > > |
In reply to this post by Pierre Smits
Hi Pierre,
I assume you generated the list from the database? why not use <entity-condition with the condition you want to search on? regards, Hans On Wed, 2011-06-22 at 11:04 +0200, Pierre Smits wrote: > Hi all, > > I am stumped... I need to iterate through a list to find the the first entry > given a set of parameters in a simple-method, but how do I escape from the > iteration after having found the entry? > > I know that in groovy I can do a while loop and if I have found the entry I > can issue a 'break; and close the iteration. But how do I do this in the > interation in a simple-method? > > Regards, > > Pierre -- Ofbiz on twitter: http://twitter.com/apache_ofbiz Myself on twitter: http://twitter.com/hansbak Antwebsystems.com: Quality services for competitive rates. |
Hi all,
In this case we can use <entity-one> , which will bring only on record. thanks prasath rajan On Wed, Jun 22, 2011 at 3:19 PM, Hans Bakker <[hidden email]>wrote: > Hi Pierre, > > I assume you generated the list from the database? > why not use <entity-condition with the condition you want to search on? > > regards, > Hans > > On Wed, 2011-06-22 at 11:04 +0200, Pierre Smits wrote: > > Hi all, > > > > I am stumped... I need to iterate through a list to find the the first > entry > > given a set of parameters in a simple-method, but how do I escape from > the > > iteration after having found the entry? > > > > I know that in groovy I can do a while loop and if I have found the entry > I > > can issue a 'break; and close the iteration. But how do I do this in the > > interation in a simple-method? > > > > Regards, > > > > Pierre > > -- > Ofbiz on twitter: http://twitter.com/apache_ofbiz > Myself on twitter: http://twitter.com/hansbak > Antwebsystems.com: Quality services for competitive rates. > >
prasath rajan
9442369696
|
In reply to this post by Pierre Smits
A <break/> element would be a useful addition to mini-language. If
anyone is interested in creating it, I will take a look at it. -Adrian On 6/22/2011 10:04 AM, Pierre Smits wrote: > Hi all, > > I am stumped... I need to iterate through a list to find the the first entry > given a set of parameters in a simple-method, but how do I escape from the > iteration after having found the entry? > > I know that in groovy I can do a while loop and if I have found the entry I > can issue a 'break; and close the iteration. But how do I do this in the > interation in a simple-method? > > Regards, > > Pierre > |
update if you get anything
prasath rajan On Wed, Jun 22, 2011 at 3:42 PM, Adrian Crum < [hidden email]> wrote: > A <break/> element would be a useful addition to mini-language. If anyone > is interested in creating it, I will take a look at it. > > -Adrian > > > On 6/22/2011 10:04 AM, Pierre Smits wrote: > >> Hi all, >> >> I am stumped... I need to iterate through a list to find the the first >> entry >> given a set of parameters in a simple-method, but how do I escape from the >> iteration after having found the entry? >> >> I know that in groovy I can do a while loop and if I have found the entry >> I >> can issue a 'break; and close the iteration. But how do I do this in the >> interation in a simple-method? >> >> Regards, >> >> Pierre >> >>
prasath rajan
9442369696
|
In reply to this post by Adrian Crum-3
+1 - Thanks Adrian.
-- Ashish On Wed, Jun 22, 2011 at 3:42 PM, Adrian Crum < [hidden email]> wrote: > A <break/> element would be a useful addition to mini-language. If anyone > is interested in creating it, I will take a look at it. > > -Adrian > > > On 6/22/2011 10:04 AM, Pierre Smits wrote: > >> Hi all, >> >> I am stumped... I need to iterate through a list to find the the first >> entry >> given a set of parameters in a simple-method, but how do I escape from the >> iteration after having found the entry? >> >> I know that in groovy I can do a while loop and if I have found the entry >> I >> can issue a 'break; and close the iteration. But how do I do this in the >> interation in a simple-method? >> >> Regards, >> >> Pierre >> >> |
In reply to this post by Pierre Smits
Use a while loop and change the condition to false once you're done, you'll have to manually iterate though. Or you could do as suggested and use the return tag, just move the loop out to a separate inline simple-method so that the return only effects the loop.
Regards Scott HotWax Media http://www.hotwaxmedia.com On 22/06/2011, at 9:04 PM, Pierre Smits wrote: > Hi all, > > I am stumped... I need to iterate through a list to find the the first entry > given a set of parameters in a simple-method, but how do I escape from the > iteration after having found the entry? > > I know that in groovy I can do a while loop and if I have found the entry I > can issue a 'break; and close the iteration. But how do I do this in the > interation in a simple-method? > > Regards, > > Pierre smime.p7s (3K) Download Attachment |
In reply to this post by hans_bakker
Hi Hans,
Let me elaborate on the problem I have. For a customer I have to expand the processing of project time entries so that they can do bulk processing of multiple time entries on multiple projects. In current setup of processing all is done with screen <screen name ="projectBilling"> in ProjectScreens.xml and forms <form name="hoursNotYetBilled"> and <form name="AddProjectTimeToNewInvoice">, but before the forms are rendered groovy code <script location="component://projectmgr/webapp/projectmgr/WEB-INF/actions/ProjectBilling.groovy"/> is executed for the individual project, setting the invoice object and parameters like partyIdFrom, partyId and invoicdeId. In the bulkprocessing this must also occur, but the groovy code for the individual project has the break to excape from the iteration of the entryItems after the frist invoice with status "INVOICE_IN_PROCESS" has been found. So I need to recreate that groovy process in the simple method as well. Or am I mistaken and chasing the wrong ball? Regards, Pierre 2011/6/22 Hans Bakker <[hidden email]> > Hi Pierre, > > I assume you generated the list from the database? > why not use <entity-condition with the condition you want to search on? > > regards, > Hans > > On Wed, 2011-06-22 at 11:04 +0200, Pierre Smits wrote: > > Hi all, > > > > I am stumped... I need to iterate through a list to find the the first > entry > > given a set of parameters in a simple-method, but how do I escape from > the > > iteration after having found the entry? > > > > I know that in groovy I can do a while loop and if I have found the entry > I > > can issue a 'break; and close the iteration. But how do I do this in the > > interation in a simple-method? > > > > Regards, > > > > Pierre > > -- > Ofbiz on twitter: http://twitter.com/apache_ofbiz > Myself on twitter: http://twitter.com/hansbak > Antwebsystems.com: Quality services for competitive rates. > > |
Hi Pierre, long time no talk!
It looks like you want iterate a number of screen sections? did you look at the <iterate-section within a <widget ? If you want to create invoices for a number of projects at the same time then i would get these projects in a list and then process every project normally... let me know how i can help you further.... Regards, Hans On Wed, 2011-06-22 at 12:36 +0200, Pierre Smits wrote: > Hi Hans, > > Let me elaborate on the problem I have. > > For a customer I have to expand the processing of project time entries so > that they can do bulk processing of multiple time entries on multiple > projects. > > In current setup of processing all is done with screen <screen name > ="projectBilling"> in ProjectScreens.xml and forms <form > name="hoursNotYetBilled"> and <form name="AddProjectTimeToNewInvoice">, but > before the forms are rendered groovy code <script > location="component://projectmgr/webapp/projectmgr/WEB-INF/actions/ProjectBilling.groovy"/> > is executed for the individual project, setting the invoice object and > parameters like partyIdFrom, partyId and invoicdeId. > > In the bulkprocessing this must also occur, but the groovy code for the > individual project has the break to excape from the iteration of the > entryItems after the frist invoice with status "INVOICE_IN_PROCESS" has been > found. > > So I need to recreate that groovy process in the simple method as well. Or > am I mistaken and chasing the wrong ball? > > Regards, > > Pierre > > 2011/6/22 Hans Bakker <[hidden email]> > > > Hi Pierre, > > > > I assume you generated the list from the database? > > why not use <entity-condition with the condition you want to search on? > > > > regards, > > Hans > > > > On Wed, 2011-06-22 at 11:04 +0200, Pierre Smits wrote: > > > Hi all, > > > > > > I am stumped... I need to iterate through a list to find the the first > > entry > > > given a set of parameters in a simple-method, but how do I escape from > > the > > > iteration after having found the entry? > > > > > > I know that in groovy I can do a while loop and if I have found the entry > > I > > > can issue a 'break; and close the iteration. But how do I do this in the > > > interation in a simple-method? > > > > > > Regards, > > > > > > Pierre > > > > -- > > Ofbiz on twitter: http://twitter.com/apache_ofbiz > > Myself on twitter: http://twitter.com/hansbak > > Antwebsystems.com: Quality services for competitive rates. > > > > -- Ofbiz on twitter: http://twitter.com/apache_ofbiz Myself on twitter: http://twitter.com/hansbak Antwebsystems.com: Quality services for competitive rates. |
In reply to this post by Adrian Crum-3
+1
Thanks Adrian 2011/6/22 Adrian Crum <[hidden email]> > A <break/> element would be a useful addition to mini-language. If anyone > is interested in creating it, I will take a look at it. > > -Adrian > > > On 6/22/2011 10:04 AM, Pierre Smits wrote: > >> Hi all, >> >> I am stumped... I need to iterate through a list to find the the first >> entry >> given a set of parameters in a simple-method, but how do I escape from the >> iteration after having found the entry? >> >> I know that in groovy I can do a while loop and if I have found the entry >> I >> can issue a 'break; and close the iteration. But how do I do this in the >> interation in a simple-method? >> >> Regards, >> >> Pierre >> >> |
hi Pierre,
not able to understand what is the solution. what is +1. prasath rajan On Wed, Jun 22, 2011 at 4:39 PM, Pierre Smits <[hidden email]>wrote: > +1 > > Thanks Adrian > > 2011/6/22 Adrian Crum <[hidden email]> > > > A <break/> element would be a useful addition to mini-language. If anyone > > is interested in creating it, I will take a look at it. > > > > -Adrian > > > > > > On 6/22/2011 10:04 AM, Pierre Smits wrote: > > > >> Hi all, > >> > >> I am stumped... I need to iterate through a list to find the the first > >> entry > >> given a set of parameters in a simple-method, but how do I escape from > the > >> iteration after having found the entry? > >> > >> I know that in groovy I can do a while loop and if I have found the > entry > >> I > >> can issue a 'break; and close the iteration. But how do I do this in the > >> interation in a simple-method? > >> > >> Regards, > >> > >> Pierre > >> > >> >
prasath rajan
9442369696
|
Le 22/06/2011 13:12, prasanth r a écrit :
> hi Pierre, > > not able to understand what is the solution. > what is +1. > Hi, here is for the +1 : http://www.apache.org/foundation/voting.html > prasath rajan > > -- Erwan de FERRIERES www.nereide.biz |
Prasanth,
Also keep in mind that this is an open source project, so everyone can contribute. If you think of an improvement, create a Jira issue for it and we will try to get it included in the project. -Adrian On 6/22/2011 1:44 PM, Erwan de FERRIERES wrote: > Le 22/06/2011 13:12, prasanth r a écrit : >> hi Pierre, >> >> not able to understand what is the solution. >> what is +1. >> > Hi, > > here is for the +1 : http://www.apache.org/foundation/voting.html >> prasath rajan >> >> > > |
In reply to this post by Adrian Crum-3
The implementation would not be trivial, the simple method structure wouldn't easily support this type of control flow. Plus it would be difficult to get the xsd right, allowing the operation to appear only within the iterable operations but possibly deeply nested.
Regards Scott On 22/06/2011, at 10:12 PM, Adrian Crum wrote: > A <break/> element would be a useful addition to mini-language. If anyone is interested in creating it, I will take a look at it. > > -Adrian > > On 6/22/2011 10:04 AM, Pierre Smits wrote: >> Hi all, >> >> I am stumped... I need to iterate through a list to find the the first entry >> given a set of parameters in a simple-method, but how do I escape from the >> iteration after having found the entry? >> >> I know that in groovy I can do a while loop and if I have found the entry I >> can issue a 'break; and close the iteration. But how do I do this in the >> interation in a simple-method? >> >> Regards, >> >> Pierre >> smime.p7s (3K) Download Attachment |
Free forum by Nabble | Edit this page |