[OFBiz] Dev - looping in simple-xml

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

[OFBiz] Dev - looping in simple-xml

Si Chen-2
Is there anyway to loop a number of times in simple-xml, such as

for (i = 0; i < 5; i++) {
...
}

?

Thanks,

Si
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

RE: [OFBiz] Dev - looping in simple-xml

Chris Chesney
We've done it like this.  Ugly, but it works.  Is there a better way or
is it worth adding some functionality to the iterate tag?

<string-to-list string="1" list-name="counter"/>
<string-to-list string="2" list-name="counter"/>
<string-to-list string="3" list-name="counter"/>
<string-to-list string="4" list-name="counter"/>
<string-to-list string="5" list-name="counter"/>
<iterate list-name="counter" entry-name="currentRow">
        ...
        <calculate field-name="fundsItemId" type="Integer">
                <calcop operator="add" field-name="currentRow"/>
        </calculate>
        ...
</iterate>

-Chris

> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]]
On

> Behalf Of Si Chen
> Sent: Monday, July 18, 2005 10:50 AM
> To: OFBiz Development
> Subject: [OFBiz] Dev - looping in simple-xml
>
> Is there anyway to loop a number of times in simple-xml, such as
>
> for (i = 0; i < 5; i++) {
> ...
> }
>
> ?
>
> Thanks,
>
> Si
>
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/dev
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: [OFBiz] Dev - looping in simple-xml

David E. Jones

Yeah, that is an ugly way to do it....

What is it that this is being used for? I mean, what is the code  
inside the loop doing or what is it that the index is being used to  
look up?

This question has come up before, but usually a numeric index loop  
isn't the best solution anyway. If needed a new operation could  
certainly be added...

This code snippet below looks like it is being used to create a  
sequenced ID, though with other code left out I can't tell. The usual  
solution is to use something like make-next-seq-id which does sub-
sequence ID generation.

-David


On Jul 18, 2005, at 11:36 AM, Chris Chesney wrote:

> We've done it like this.  Ugly, but it works.  Is there a better  
> way or
> is it worth adding some functionality to the iterate tag?
>
> <string-to-list string="1" list-name="counter"/>
> <string-to-list string="2" list-name="counter"/>
> <string-to-list string="3" list-name="counter"/>
> <string-to-list string="4" list-name="counter"/>
> <string-to-list string="5" list-name="counter"/>
> <iterate list-name="counter" entry-name="currentRow">
>     ...
>     <calculate field-name="fundsItemId" type="Integer">
>         <calcop operator="add" field-name="currentRow"/>
>     </calculate>
>     ...
> </iterate>
>
> -Chris
>
>
>> -----Original Message-----
>> From: [hidden email] [mailto:dev-
>> [hidden email]]
>>
> On
>
>> Behalf Of Si Chen
>> Sent: Monday, July 18, 2005 10:50 AM
>> To: OFBiz Development
>> Subject: [OFBiz] Dev - looping in simple-xml
>>
>> Is there anyway to loop a number of times in simple-xml, such as
>>
>> for (i = 0; i < 5; i++) {
>> ...
>> }
>>
>> ?
>>
>> Thanks,
>>
>> Si
>>
>> _______________________________________________
>> Dev mailing list
>> [hidden email]
>> http://lists.ofbiz.org/mailman/listinfo/dev
>>
>
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/dev
>

 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: [OFBiz] Dev - looping in simple-xml

Si Chen-2
To fix the problem with serialized inventory:

http://jira.undersunconsulting.com/browse/OFBIZ-354

I thought we'd need to loop through the quantity # and create a series
of inventoryItem, one for each unit quantity of serialized inventory.

Si

David E. Jones wrote:

>
> Yeah, that is an ugly way to do it....
>
> What is it that this is being used for? I mean, what is the code  
> inside the loop doing or what is it that the index is being used to  
> look up?
>
> This question has come up before, but usually a numeric index loop  
> isn't the best solution anyway. If needed a new operation could  
> certainly be added...
>
> This code snippet below looks like it is being used to create a  
> sequenced ID, though with other code left out I can't tell. The usual  
> solution is to use something like make-next-seq-id which does sub-
> sequence ID generation.
>
> -David
>
>
> On Jul 18, 2005, at 11:36 AM, Chris Chesney wrote:
>
>> We've done it like this.  Ugly, but it works.  Is there a better  way or
>> is it worth adding some functionality to the iterate tag?
>>
>> <string-to-list string="1" list-name="counter"/>
>> <string-to-list string="2" list-name="counter"/>
>> <string-to-list string="3" list-name="counter"/>
>> <string-to-list string="4" list-name="counter"/>
>> <string-to-list string="5" list-name="counter"/>
>> <iterate list-name="counter" entry-name="currentRow">
>>     ...
>>     <calculate field-name="fundsItemId" type="Integer">
>>         <calcop operator="add" field-name="currentRow"/>
>>     </calculate>
>>     ...
>> </iterate>
>>
>> -Chris
>>
>>
>>> -----Original Message-----
>>> From: [hidden email] [mailto:dev- [hidden email]]
>>>
>> On
>>
>>> Behalf Of Si Chen
>>> Sent: Monday, July 18, 2005 10:50 AM
>>> To: OFBiz Development
>>> Subject: [OFBiz] Dev - looping in simple-xml
>>>
>>> Is there anyway to loop a number of times in simple-xml, such as
>>>
>>> for (i = 0; i < 5; i++) {
>>> ...
>>> }
>>>
>>> ?
>>>
>>> Thanks,
>>>
>>> Si
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [hidden email]
>>> http://lists.ofbiz.org/mailman/listinfo/dev
>>>
>>
>> _______________________________________________
>> Dev mailing list
>> [hidden email]
>> http://lists.ofbiz.org/mailman/listinfo/dev
>>
>
>
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/dev
>
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

RE: [OFBiz] Dev - looping in simple-xml

Chris Chesney
In reply to this post by Si Chen-2
David,

Yep, it's being used for sub-sequence ID generation.  I need to maintain
a numbered, sequential list of items in a child table -- I didn't know
you could do that with make-next-seq-id.  Any chance you know of an
example off the top of your head?
 
-Chris

> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]]
On

> Behalf Of David E. Jones
> Sent: Monday, July 18, 2005 3:27 PM
> To: OFBiz Project Development Discussion
> Subject: Re: [OFBiz] Dev - looping in simple-xml
>
>
> Yeah, that is an ugly way to do it....
>
> What is it that this is being used for? I mean, what is the code
> inside the loop doing or what is it that the index is being used to
> look up?
>
> This question has come up before, but usually a numeric index loop
> isn't the best solution anyway. If needed a new operation could
> certainly be added...
>
> This code snippet below looks like it is being used to create a
> sequenced ID, though with other code left out I can't tell. The usual
> solution is to use something like make-next-seq-id which does sub-
> sequence ID generation.
>
> -David
>
>
> On Jul 18, 2005, at 11:36 AM, Chris Chesney wrote:
>
> > We've done it like this.  Ugly, but it works.  Is there a better
> > way or
> > is it worth adding some functionality to the iterate tag?
> >
> > <string-to-list string="1" list-name="counter"/>
> > <string-to-list string="2" list-name="counter"/>
> > <string-to-list string="3" list-name="counter"/>
> > <string-to-list string="4" list-name="counter"/>
> > <string-to-list string="5" list-name="counter"/>
> > <iterate list-name="counter" entry-name="currentRow">
> >     ...
> >     <calculate field-name="fundsItemId" type="Integer">
> >         <calcop operator="add" field-name="currentRow"/>
> >     </calculate>
> >     ...
> > </iterate>
> >
> > -Chris
> >
> >
> >> -----Original Message-----
> >> From: [hidden email] [mailto:dev-
> >> [hidden email]]
> >>
> > On
> >
> >> Behalf Of Si Chen
> >> Sent: Monday, July 18, 2005 10:50 AM
> >> To: OFBiz Development
> >> Subject: [OFBiz] Dev - looping in simple-xml
> >>
> >> Is there anyway to loop a number of times in simple-xml, such as
> >>
> >> for (i = 0; i < 5; i++) {
> >> ...
> >> }
> >>
> >> ?
> >>
> >> Thanks,
> >>
> >> Si
> >>
> >> _______________________________________________
> >> Dev mailing list
> >> [hidden email]
> >> http://lists.ofbiz.org/mailman/listinfo/dev
> >>
> >
> > _______________________________________________
> > Dev mailing list
> > [hidden email]
> > http://lists.ofbiz.org/mailman/listinfo/dev
> >
>
>
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/dev
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: [OFBiz] Dev - looping in simple-xml

David E. Jones

To find an example I would just search for it. I'd tell you of one  
off the top of my head but I can't remember any right now, so all I'd  
do is search all *Services.xml files to find some examples.

-David


On Jul 18, 2005, at 3:52 PM, Chris Chesney wrote:

> David,
>
> Yep, it's being used for sub-sequence ID generation.  I need to  
> maintain
> a numbered, sequential list of items in a child table -- I didn't know
> you could do that with make-next-seq-id.  Any chance you know of an
> example off the top of your head?
>
> -Chris
>
>
>> -----Original Message-----
>> From: [hidden email] [mailto:dev-
>> [hidden email]]
>>
> On
>
>> Behalf Of David E. Jones
>> Sent: Monday, July 18, 2005 3:27 PM
>> To: OFBiz Project Development Discussion
>> Subject: Re: [OFBiz] Dev - looping in simple-xml
>>
>>
>> Yeah, that is an ugly way to do it....
>>
>> What is it that this is being used for? I mean, what is the code
>> inside the loop doing or what is it that the index is being used to
>> look up?
>>
>> This question has come up before, but usually a numeric index loop
>> isn't the best solution anyway. If needed a new operation could
>> certainly be added...
>>
>> This code snippet below looks like it is being used to create a
>> sequenced ID, though with other code left out I can't tell. The usual
>> solution is to use something like make-next-seq-id which does sub-
>> sequence ID generation.
>>
>> -David
>>
>>
>> On Jul 18, 2005, at 11:36 AM, Chris Chesney wrote:
>>
>>
>>> We've done it like this.  Ugly, but it works.  Is there a better
>>> way or
>>> is it worth adding some functionality to the iterate tag?
>>>
>>> <string-to-list string="1" list-name="counter"/>
>>> <string-to-list string="2" list-name="counter"/>
>>> <string-to-list string="3" list-name="counter"/>
>>> <string-to-list string="4" list-name="counter"/>
>>> <string-to-list string="5" list-name="counter"/>
>>> <iterate list-name="counter" entry-name="currentRow">
>>>     ...
>>>     <calculate field-name="fundsItemId" type="Integer">
>>>         <calcop operator="add" field-name="currentRow"/>
>>>     </calculate>
>>>     ...
>>> </iterate>
>>>
>>> -Chris
>>>
>>>
>>>
>>>> -----Original Message-----
>>>> From: [hidden email] [mailto:dev-
>>>> [hidden email]]
>>>>
>>>>
>>> On
>>>
>>>
>>>> Behalf Of Si Chen
>>>> Sent: Monday, July 18, 2005 10:50 AM
>>>> To: OFBiz Development
>>>> Subject: [OFBiz] Dev - looping in simple-xml
>>>>
>>>> Is there anyway to loop a number of times in simple-xml, such as
>>>>
>>>> for (i = 0; i < 5; i++) {
>>>> ...
>>>> }
>>>>
>>>> ?
>>>>
>>>> Thanks,
>>>>
>>>> Si
>>>>
>>>> _______________________________________________
>>>> Dev mailing list
>>>> [hidden email]
>>>> http://lists.ofbiz.org/mailman/listinfo/dev
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [hidden email]
>>> http://lists.ofbiz.org/mailman/listinfo/dev
>>>
>>>
>>
>>
>> _______________________________________________
>> Dev mailing list
>> [hidden email]
>> http://lists.ofbiz.org/mailman/listinfo/dev
>>
>
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/dev
>

 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev