You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Leyzerzon, Simeon G" <Si...@gs.com> on 2003/02/27 15:37:15 UTC

how to model this in context

I need to produce the following output:
============================================================================
========================
.X blockbeg "Branch #5967"

48043922~~RUNNELS,,CARLOS
A,~2/13/98~3/28/98~~~5/31/03~11/16/02~500~325.19~05/03/03~60~1,564.56
48048927~~MYKLEBUST,,GARY
J,M~9/26/96~11/25/96~~~12/25/02~12/2/02~2,478.68~331.55~06/03/03~72~3.2
48068918~~TEDROW,,MINNIE
L,~9/17/99~11/1/99~~~11/1/03~11/24/02~3,193.00~246.85~11/03/03~48~107.33
48069784~~DYER,,FREDERICK,NAN~8/26/99~9/26/99~~~8/26/03~12/19/02~126.27~43.2
9~06/03/03~48~3.17
48085205~~MCBRIDE,,ROGER
D,EL~10/21/95~11/21/95~~~10/21/05~11/7/02~19,581.02~1,631.75~10/03/03~120~49
,486.25
48086311~~LOPEZ,,BENIGNO
C,VI~3/24/97~5/8/97~~~8/8/03~10/15/02~6,902.79~414.88~10/03/03~72~6.72
48086366~~GRIMM,,MARY
E,~4/15/97~5/28/97~~~4/28/03~12/22/02~1,440.92~456.44~05/03/03~72~9.94
48096799~~SORENSEN,,VERN
R,KR~2/24/94~3/20/94~~~2/20/04~12/30/02~141.23~141.23~05/03/03~120~2,870.72
48105232~~CLARK,,MICHAEL
L,LI~4/29/94~6/13/94~~~5/13/04~12/26/02~400~379.11~10/03/03~120~15,017.93
48105697~~HOLT,,ALFRED
L,~7/17/93~8/31/93~~~7/31/03~12/16/02~250~154.85~12/03/03~120~1,739.93
48105744~~REEVE,,REX,CARLA
J~7/20/93~9/3/93~~~9/3/03~12/21/02~192.5~192.5~06/04/03~120~1,039.21

.X summbeg
Totals for #5967~~~~~~~~~35,206.41~4,317.64~~~71,848.96
.X summend

.X blockend


.X blockbeg "Branch #5969"

48048927~~MYKLEBUST,,GARY
J,M~9/26/96~11/25/96~~~12/25/02~12/2/02~2,478.68~331.55~06/03/03~72~3.2
48068918~~TEDROW,,MINNIE
L,~9/17/99~11/1/99~~~11/1/03~11/24/02~3,193.00~246.85~11/03/03~48~107.33
48069784~~DYER,,FREDERICK,NAN~8/26/99~9/26/99~~~8/26/03~12/19/02~126.27~43.2
9~06/03/03~48~3.17
48086311~~LOPEZ,,BENIGNO
C,VI~3/24/97~5/8/97~~~8/8/03~10/15/02~6,902.79~414.88~10/03/03~72~6.72
48096799~~SORENSEN,,VERN
R,KR~2/24/94~3/20/94~~~2/20/04~12/30/02~141.23~141.23~05/03/03~120~2,870.72
48105232~~CLARK,,MICHAEL
L,LI~4/29/94~6/13/94~~~5/13/04~12/26/02~400~379.11~10/03/03~120~15,017.93
48105697~~HOLT,,ALFRED
L,~7/17/93~8/31/93~~~7/31/03~12/16/02~250~154.85~12/03/03~120~1,739.93

.X summbeg
Totals for #5969 ~~~~~~~~~35,206.41~4,317.64~~~71,848.96
.X summend

.X blockend

.X blockbeg "Branch #5971"

48048927~~MYKLEBUST,,GARY
J,M~9/26/96~11/25/96~~~12/25/02~12/2/02~2,478.68~331.55~06/03/03~72~3.2
48068918~~TEDROW,,MINNIE
L,~9/17/99~11/1/99~~~11/1/03~11/24/02~3,193.00~246.85~11/03/03~48~107.33
48069784~~DYER,,FREDERICK,NAN~8/26/99~9/26/99~~~8/26/03~12/19/02~126.27~43.2
9~06/03/03~48~3.17
48086311~~LOPEZ,,BENIGNO
C,VI~3/24/97~5/8/97~~~8/8/03~10/15/02~6,902.79~414.88~10/03/03~72~6.72
48096799~~SORENSEN,,VERN
R,KR~2/24/94~3/20/94~~~2/20/04~12/30/02~141.23~141.23~05/03/03~120~2,870.72
48105232~~CLARK,,MICHAEL
L,LI~4/29/94~6/13/94~~~5/13/04~12/26/02~400~379.11~10/03/03~120~15,017.93
48105697~~HOLT,,ALFRED
L,~7/17/93~8/31/93~~~7/31/03~12/16/02~250~154.85~12/03/03~120~1,739.93
48105744~~REEVE,,REX,CARLA
J~7/20/93~9/3/93~~~9/3/03~12/21/02~192.5~192.5~06/04/03~120~1,039.21
48048927~~MYKLEBUST,,GARY
J,M~9/26/96~11/25/96~~~12/25/02~12/2/02~2,478.68~331.55~06/03/03~72~3.2
48068918~~TEDROW,,MINNIE
L,~9/17/99~11/1/99~~~11/1/03~11/24/02~3,193.00~246.85~11/03/03~48~107.33
48069784~~DYER,,FREDERICK,NAN~8/26/99~9/26/99~~~8/26/03~12/19/02~126.27~43.2
9~06/03/03~48~3.17
48086311~~LOPEZ,,BENIGNO
C,VI~3/24/97~5/8/97~~~8/8/03~10/15/02~6,902.79~414.88~10/03/03~72~6.72
48096799~~SORENSEN,,VERN
R,KR~2/24/94~3/20/94~~~2/20/04~12/30/02~141.23~141.23~05/03/03~120~2,870.72
48105232~~CLARK,,MICHAEL
L,LI~4/29/94~6/13/94~~~5/13/04~12/26/02~400~379.11~10/03/03~120~15,017.93
48105697~~HOLT,,ALFRED
L,~7/17/93~8/31/93~~~7/31/03~12/16/02~250~154.85~12/03/03~120~1,739.93
48105744~~REEVE,,REX,CARLA
J~7/20/93~9/3/93~~~9/3/03~12/21/02~192.5~192.5~06/04/03~120~1,039.21


.X summbeg
Totals for #5971 ~~~~~~~~~35,206.41~4,317.64~~~71,848.96
.X summend

.X blockend
============================================================================
=============================

The data is grouped by branch # which are produced in Java from SQL call.
The lines starting with .X are just some commands that need to be rendered
as simple ascii text.
Each piece of data in a row (which maps to column in a resultset) is
delimited by "~" character and a line feed character at the end of the line.

I'm not sure how to represent this structure when I'm putting it into the
context object so that I could efficiently render it using some foreach
statements.  
Can someone please give me any insights or experiences on implementing this
type of behavior.

Thank you in advance.
Simeon


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: how to model this in context

Posted by Anthony Eden <ae...@signaturedomains.com>.
I would contruct a list of Branch objects, where the Branch object has 
an ID property and then a List of Entry objects.  Each Entry would then 
contain the information such as first, missle and last name, dates, 
etc.  The point is to get stuff out of your result set and put it in a 
usable object model, making it easier to access from inside of 
Velocity.  The only compelling reason for not doing this is if their is 
so much data that it would not be practical to create an internal object 
model.

The Velocity template would look something like this:

#foreach ($branch in $branches)
render branch header
 #foreach ($entry in $branch.getEntries())
  render entry
 #end
render branch footer
#end

Sincerely,
Anthony Eden

Leyzerzon, Simeon G wrote:

>I need to produce the following output:
>============================================================================
>========================
>.X blockbeg "Branch #5967"
>
>48043922~~RUNNELS,,CARLOS
>A,~2/13/98~3/28/98~~~5/31/03~11/16/02~500~325.19~05/03/03~60~1,564.56
>48048927~~MYKLEBUST,,GARY
>J,M~9/26/96~11/25/96~~~12/25/02~12/2/02~2,478.68~331.55~06/03/03~72~3.2
>48068918~~TEDROW,,MINNIE
>L,~9/17/99~11/1/99~~~11/1/03~11/24/02~3,193.00~246.85~11/03/03~48~107.33
>48069784~~DYER,,FREDERICK,NAN~8/26/99~9/26/99~~~8/26/03~12/19/02~126.27~43.2
>9~06/03/03~48~3.17
>48085205~~MCBRIDE,,ROGER
>D,EL~10/21/95~11/21/95~~~10/21/05~11/7/02~19,581.02~1,631.75~10/03/03~120~49
>,486.25
>48086311~~LOPEZ,,BENIGNO
>C,VI~3/24/97~5/8/97~~~8/8/03~10/15/02~6,902.79~414.88~10/03/03~72~6.72
>48086366~~GRIMM,,MARY
>E,~4/15/97~5/28/97~~~4/28/03~12/22/02~1,440.92~456.44~05/03/03~72~9.94
>48096799~~SORENSEN,,VERN
>R,KR~2/24/94~3/20/94~~~2/20/04~12/30/02~141.23~141.23~05/03/03~120~2,870.72
>48105232~~CLARK,,MICHAEL
>L,LI~4/29/94~6/13/94~~~5/13/04~12/26/02~400~379.11~10/03/03~120~15,017.93
>48105697~~HOLT,,ALFRED
>L,~7/17/93~8/31/93~~~7/31/03~12/16/02~250~154.85~12/03/03~120~1,739.93
>48105744~~REEVE,,REX,CARLA
>J~7/20/93~9/3/93~~~9/3/03~12/21/02~192.5~192.5~06/04/03~120~1,039.21
>
>.X summbeg
>Totals for #5967~~~~~~~~~35,206.41~4,317.64~~~71,848.96
>.X summend
>
>.X blockend
>
>
>.X blockbeg "Branch #5969"
>
>48048927~~MYKLEBUST,,GARY
>J,M~9/26/96~11/25/96~~~12/25/02~12/2/02~2,478.68~331.55~06/03/03~72~3.2
>48068918~~TEDROW,,MINNIE
>L,~9/17/99~11/1/99~~~11/1/03~11/24/02~3,193.00~246.85~11/03/03~48~107.33
>48069784~~DYER,,FREDERICK,NAN~8/26/99~9/26/99~~~8/26/03~12/19/02~126.27~43.2
>9~06/03/03~48~3.17
>48086311~~LOPEZ,,BENIGNO
>C,VI~3/24/97~5/8/97~~~8/8/03~10/15/02~6,902.79~414.88~10/03/03~72~6.72
>48096799~~SORENSEN,,VERN
>R,KR~2/24/94~3/20/94~~~2/20/04~12/30/02~141.23~141.23~05/03/03~120~2,870.72
>48105232~~CLARK,,MICHAEL
>L,LI~4/29/94~6/13/94~~~5/13/04~12/26/02~400~379.11~10/03/03~120~15,017.93
>48105697~~HOLT,,ALFRED
>L,~7/17/93~8/31/93~~~7/31/03~12/16/02~250~154.85~12/03/03~120~1,739.93
>
>.X summbeg
>Totals for #5969 ~~~~~~~~~35,206.41~4,317.64~~~71,848.96
>.X summend
>
>.X blockend
>
>.X blockbeg "Branch #5971"
>
>48048927~~MYKLEBUST,,GARY
>J,M~9/26/96~11/25/96~~~12/25/02~12/2/02~2,478.68~331.55~06/03/03~72~3.2
>48068918~~TEDROW,,MINNIE
>L,~9/17/99~11/1/99~~~11/1/03~11/24/02~3,193.00~246.85~11/03/03~48~107.33
>48069784~~DYER,,FREDERICK,NAN~8/26/99~9/26/99~~~8/26/03~12/19/02~126.27~43.2
>9~06/03/03~48~3.17
>48086311~~LOPEZ,,BENIGNO
>C,VI~3/24/97~5/8/97~~~8/8/03~10/15/02~6,902.79~414.88~10/03/03~72~6.72
>48096799~~SORENSEN,,VERN
>R,KR~2/24/94~3/20/94~~~2/20/04~12/30/02~141.23~141.23~05/03/03~120~2,870.72
>48105232~~CLARK,,MICHAEL
>L,LI~4/29/94~6/13/94~~~5/13/04~12/26/02~400~379.11~10/03/03~120~15,017.93
>48105697~~HOLT,,ALFRED
>L,~7/17/93~8/31/93~~~7/31/03~12/16/02~250~154.85~12/03/03~120~1,739.93
>48105744~~REEVE,,REX,CARLA
>J~7/20/93~9/3/93~~~9/3/03~12/21/02~192.5~192.5~06/04/03~120~1,039.21
>48048927~~MYKLEBUST,,GARY
>J,M~9/26/96~11/25/96~~~12/25/02~12/2/02~2,478.68~331.55~06/03/03~72~3.2
>48068918~~TEDROW,,MINNIE
>L,~9/17/99~11/1/99~~~11/1/03~11/24/02~3,193.00~246.85~11/03/03~48~107.33
>48069784~~DYER,,FREDERICK,NAN~8/26/99~9/26/99~~~8/26/03~12/19/02~126.27~43.2
>9~06/03/03~48~3.17
>48086311~~LOPEZ,,BENIGNO
>C,VI~3/24/97~5/8/97~~~8/8/03~10/15/02~6,902.79~414.88~10/03/03~72~6.72
>48096799~~SORENSEN,,VERN
>R,KR~2/24/94~3/20/94~~~2/20/04~12/30/02~141.23~141.23~05/03/03~120~2,870.72
>48105232~~CLARK,,MICHAEL
>L,LI~4/29/94~6/13/94~~~5/13/04~12/26/02~400~379.11~10/03/03~120~15,017.93
>48105697~~HOLT,,ALFRED
>L,~7/17/93~8/31/93~~~7/31/03~12/16/02~250~154.85~12/03/03~120~1,739.93
>48105744~~REEVE,,REX,CARLA
>J~7/20/93~9/3/93~~~9/3/03~12/21/02~192.5~192.5~06/04/03~120~1,039.21
>
>
>.X summbeg
>Totals for #5971 ~~~~~~~~~35,206.41~4,317.64~~~71,848.96
>.X summend
>
>.X blockend
>============================================================================
>=============================
>
>The data is grouped by branch # which are produced in Java from SQL call.
>The lines starting with .X are just some commands that need to be rendered
>as simple ascii text.
>Each piece of data in a row (which maps to column in a resultset) is
>delimited by "~" character and a line feed character at the end of the line.
>
>I'm not sure how to represent this structure when I'm putting it into the
>context object so that I could efficiently render it using some foreach
>statements.  
>Can someone please give me any insights or experiences on implementing this
>type of behavior.
>
>Thank you in advance.
>Simeon
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org