You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Eigen Technology Pty Ltd <mi...@eigentechnology.com> on 2002/12/27 23:10:37 UTC

Re: A Java Question... not working.

Thanks to all,

I have tried all that suggested, unfortunately none worked ... What Wei
has suggested compiles OK, but nothing got returned. Here is my procedure
again:

1. Extract data from DB using a PullTool
2. Data is encapsulated in a Vector.
3. Each element in this Vector contains a single row of data (multiple col).
4. Try to extract a single col of datum from a single row.

The first time when I perform the elementAt(1), it is OK, it returns a
list of Objects. I can get Velocity to display its contents by

$documents.XXX

If I perform toString() on these objects, I get only the Address of the
objects. If I perform another elementAt(x), nothing got returned. I am a
bit confused here, how is object-strings converted in general?

thanks
michael







>
> Your right hand side is an Object, you need to do a cast.  That is:
>
> String test = (String)((Object)docs.elementAt(1)).elementAt(1);
>
> or
>
> String test = ((Doc)docs.get(1)).getDocString();
>
> or
>
> String test = (docs.elementAt(1)).elementAt(1).toString();
>
> It depends on the type you have for the first field in your doc object.
>   If it is a BigDecimal, direct cast may not work, toString() will do.
> You see my point.
>
> Hope this helps.
>
> Eigen Technology Pty Ltd wrote:
>> I could possibly write a servlet to extract and then filter the data,
>> but I think that would defeat the purpose of having Turbine in the
>> first place.
>>
>> I tried:
>>
>>  String test = ((Object)docs.elementAt(1)).elementAt(1);
>>  return test;
>>
>> the compiler did not complain, but Velocity rejected it. Really
>> running out of ideas. Any suggestion would be appreciated.
>>
>> cheers
>> michael
>>
>>
>>
>>
>>>I have a db Table consisting of 10 (say col_A, col_B, col_C, col_D,
>>> ... col_J) columns.  After accessing these data using a PullTool (as
>>> suggested by Scott and Peter), I stored them in a Vector/List. Before
>>> I display them in my .vm file, I want to perform some filtering, e.g.
>>> select col_A = "some_Text".
>>>
>>>The question is:
>>>
>>>I can extract what is in the Vector as Objects which has all ten
>>> columns in it, it returns a certain address. But How do I get data in
>>> col_A out and perform the filtering I intended to do?
>>>
>>>best wishes
>>>michael
>>>
>>>
>>>
>>>--
>>>To unsubscribe, e-mail:
>>><ma...@jakarta.apache.org> For additional
>>> commands, e-mail: <ma...@jakarta.apache.org>
>>
>>
>>
>>
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org> For additional
>> commands, e-mail: <ma...@jakarta.apache.org>
>>
>
>
> --
> Wei He
> Email: weihe@optonline.net
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org> For additional
> commands, e-mail: <ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Howto create a VECTOR for Velocity

Posted by Eigen Technology Pty Ltd <mi...@eigentechnology.com>.
Say I pulled some data from a database:

ID    Col_2     Col_3
1      A          10
2      B          20
3      C          50
4      D          100
5      E          0.5


I then perfomed some arithmatic manipulation, e.g. invert all the number
in Col_2, and now my new data are:

ID    Col_2     Col_3
1      A          0.1
2      B          0.05
3      C          0.02
4      D          0.01
5      E          20

I now want to pass these data to Velocity, I have to encapsulate them in a
Vector first. How do I do that?

If I have a Vector TEST,

TEST.addElement(??)

will only work for single col arrays. My case need to have the data put
into some form of Objects and then create the Vector ... which is what I
am asking for... thanks

michael












>
> hum, not sure what you mean by "this vector is not from Turbine". You
> can get the contents of your vector from Turbine, directly from a
> database, or anywhere else. Can you give me more infos?
>
>
> On Monday, December 30, 2002, at 03:56  PM, Eigen Technology Pty Ltd
> wrote:
>
>> Thanks for the advice,
>>
>> I knew the Pull Tool part. But my question was on how to create a
>> Vector
>> in this PullTool.
>>
>> Say you have 100 rows of data each with 6 cols in your
>>
>> $DateTool.TodaysDate()
>>
>> function. Before you pass it to Velocity, you have to package them in
>> a Vector first, right (correct me if I am wrong)? If this vector is
>> not   from
>> Turbine, how do you create it?
>>
>> cheers
>> michael
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>>
>>> you have to configure your TR.properties file. Configure the pull
>>> service by adding a line like
>>>
>>> services.PullService.tool.<scope>.<id> = <classname>
>>>
>>> for example:
>>>
>>> services.PullService.tool.request.date=com.clavie.myEvents.tool.DateTo
>>>  ol
>>>
>>> then, you should be able to access it in Velocity with sth like:
>>> $DateTool.TodaysDate()
>>>
>>> David
>>>
>>> On Monday, December 30, 2002, at 03:37  PM, Eigen Technology Pty Ltd
>>> wrote:
>>>
>>>> When Turbine extract data from a database, it creates a Vector and
>>>> returns
>>>> for Velocity to display.
>>>>
>>>> If I want to write a Java Utility, some tabulated calculated results
>>>> are
>>>> to be passed on to Velocity, i.e. Vectors not created by Turbine,
>>>> how should I do it.
>>>>
>>>> I tried:
>>>>
>>>> Vector TEST=null;
>>>>
>>>> etc....
>>>>
>>>> for(i=0; i < somelimit; ++i) {
>>>> TEST.add(someobject(i));
>>>> }
>>>> etc....
>>>>
>>>> return TEST;
>>>>
>>>> Velocity displays nothing, help is much appreciated.
>>>>
>>>> michael
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> To unsubscribe, e-mail:
>>>> <ma...@jakarta.apache.org>
>>>> For additional commands, e-mail:
>>>> <ma...@jakarta.apache.org>
>>>>
>>>
>>>
>>> --
>>> To unsubscribe, e-mail:
>>> <ma...@jakarta.apache.org> For additional
>>> commands, e-mail: <ma...@jakarta.apache.org>
>>
>>
>>
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
>>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org> For additional
> commands, e-mail: <ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Howto create a VECTOR for Velocity

Posted by Colin Chalmers <co...@maxware.nl>.
The only thing that I can see, and that's probably more to do with your
example, is that you use "entry" twice.

Do you have logs/stacktraces we could look at?

/c

----- Original Message -----
From: "Eigen Technology Pty Ltd" <mi...@eigentechnology.com>
To: <tu...@jakarta.apache.org>
Sent: Tuesday, December 31, 2002 7:30 AM
Subject: Re: Howto create a VECTOR for Velocity


> Well, the reason I raised the question was because I tried and failed
> using arrays, lists etc when passon to Velocity, i.e.
>
> context.put("entry", some_list/some_array);
> have FAILED.
>
> This is what I did:
>
> 1. I have a Vector A;   <------ context.put("entry", A) is OK with
Velocity.
> 2. But I need to do some work on the data in A. So:
> 3. Extract Object a = A.elementAt(some_position); Do what I have to do
AND:
> 4. Put it back into another Vector B.
>    B.add(modified_a);
>    context.put("entry", B);
>
> BUT velocity does not like it.
>
> I tried to vary Vector B with Array B, List B, nothing worked, anyone know
> where I have done wrong?
>
> cheers
> michael
>
>
>
>
>
>
> >
> > or you could probably use an array of an array directly.
> >
> > On Monday, December 30, 2002, at 04:24  PM, Scott Eade wrote:
> >
> >> Michael,
> >>
> >> Most people on this list will argue strongly that your velocity
> >> templates
> >> should contain only formatting code and never processing code - put
> >> this
> >> instead in a pull tool or the screen classes.
> >>
> >> Provide a method in your pull tool that provides the data you need -
> >> this
> >> might instantiate and populate a Vector or whatever else you want to
> >> do.
> >>
> >> I don't really understand the specific example you are attempting to
> >> describe below, but an object is an object, whether it is created by
> >> Turbine, Torque, your pull tool or screen class - and Velocity should
> >>  be
> >> able to access it and work with it provided that you have somehow made
> >>   it
> >> available to the context.
> >>
> >> One thing you can't do in velocity (and shouldn't be able to do) is
> >> instantiate non-primitives (other than String).  You can create
> >> references
> >> to objects, arrays, Strings and ints using #set.
> >>
> >> BTW: You may like to use ArrayList in preference to Vector.
> >>
> >> HTH,
> >>
> >> Scott
> >> --
> >> Scott Eade
> >> Backstage Technologies Pty. Ltd.
> >> http://www.backstagetech.com.au
> >> .Mac Chat/AIM: seade at mac dot com
> >>
> >>
> >> On 31/12/2002 10:56 AM, "Eigen Technology Pty Ltd"
> >> <mi...@eigentechnology.com> wrote:
> >>
> >>> Thanks for the advice,
> >>>
> >>> I knew the Pull Tool part. But my question was on how to create a
> >>> Vector
> >>> in this PullTool.
> >>>
> >>> Say you have 100 rows of data each with 6 cols in your
> >>>
> >>> $DateTool.TodaysDate()
> >>>
> >>> function. Before you pass it to Velocity, you have to package them in
> >>>   a
> >>> Vector first, right (correct me if I am wrong)? If this vector is not
> >>>   from
> >>> Turbine, how do you create it?
> >>>
> >>> cheers
> >>> michael
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>
> >>>> you have to configure your TR.properties file. Configure the pull
> >>>> service by adding a line like
> >>>>
> >>>> services.PullService.tool.<scope>.<id> = <classname>
> >>>>
> >>>> for example:
> >>>>
> >>>> services.PullService.tool.request.date=com.clavie.myEvents.tool.DateT
> >>>>  ool
> >>>>
> >>>> then, you should be able to access it in Velocity with sth like:
> >>>> $DateTool.TodaysDate()
> >>>>
> >>>> David
> >>>>
> >>>> On Monday, December 30, 2002, at 03:37  PM, Eigen Technology Pty Ltd
> >>>> wrote:
> >>>>
> >>>>> When Turbine extract data from a database, it creates a Vector and
> >>>>> returns
> >>>>> for Velocity to display.
> >>>>>
> >>>>> If I want to write a Java Utility, some tabulated calculated
> >>>>> results are
> >>>>> to be passed on to Velocity, i.e. Vectors not created by Turbine,
> >>>>> how
> >>>>> should I do it.
> >>>>>
> >>>>> I tried:
> >>>>>
> >>>>> Vector TEST=null;
> >>>>>
> >>>>> etc....
> >>>>>
> >>>>> for(i=0; i < somelimit; ++i) {
> >>>>> TEST.add(someobject(i));
> >>>>> }
> >>>>> etc....
> >>>>>
> >>>>> return TEST;
> >>>>>
> >>>>> Velocity displays nothing, help is much appreciated.
> >>>>>
> >>>>> michael
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> --
> >>>>> To unsubscribe, e-mail:
> >>>>> <ma...@jakarta.apache.org>
> >>>>> For additional commands, e-mail:
> >>>>> <ma...@jakarta.apache.org>
> >>>>>
> >>>>
> >>>>
> >>>> --
> >>>> To unsubscribe, e-mail:
> >>>> <ma...@jakarta.apache.org> For additional
> >>>> commands, e-mail: <ma...@jakarta.apache.org>
> >>>
> >>>
> >>>
> >>>
> >>> --
> >>> To unsubscribe, e-mail:
> >>> <ma...@jakarta.apache.org>
> >>> For additional commands, e-mail:
> >>> <ma...@jakarta.apache.org>
> >>>
> >>
> >>
> >> --
> >> To unsubscribe, e-mail:
> >> <ma...@jakarta.apache.org>
> >> For additional commands, e-mail:
> >> <ma...@jakarta.apache.org>
> >>
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org> For additional
> > commands, e-mail: <ma...@jakarta.apache.org>
>
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Howto create a VECTOR for Velocity

Posted by Scott Eade <se...@backstagetech.com.au>.
Why can the processing not occur before you put the list/array into the
context?  This would be the MVC thing to do and would simplify things
greatly.

Scott
-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au
.Mac Chat/AIM: seade at mac dot com


On 31/12/2002 5:30 PM, "Eigen Technology Pty Ltd"
<mi...@eigentechnology.com> wrote:

> Well, the reason I raised the question was because I tried and failed
> using arrays, lists etc when passon to Velocity, i.e.
> 
> context.put("entry", some_list/some_array);
> have FAILED.
> 
> This is what I did:
> 
> 1. I have a Vector A;   <------ context.put("entry", A) is OK with Velocity.
> 2. But I need to do some work on the data in A. So:
> 3. Extract Object a = A.elementAt(some_position); Do what I have to do AND:
> 4. Put it back into another Vector B.
>  B.add(modified_a);
>  context.put("entry", B);
> 
> BUT velocity does not like it.
> 
> I tried to vary Vector B with Array B, List B, nothing worked, anyone know
> where I have done wrong?
> 
> cheers
> michael
> 
> 
> 
> 
> 
> 
>> 
>> or you could probably use an array of an array directly.
>> 
>> On Monday, December 30, 2002, at 04:24  PM, Scott Eade wrote:
>> 
>>> Michael,
>>> 
>>> Most people on this list will argue strongly that your velocity
>>> templates
>>> should contain only formatting code and never processing code - put
>>> this
>>> instead in a pull tool or the screen classes.
>>> 
>>> Provide a method in your pull tool that provides the data you need -
>>> this
>>> might instantiate and populate a Vector or whatever else you want to
>>> do.
>>> 
>>> I don't really understand the specific example you are attempting to
>>> describe below, but an object is an object, whether it is created by
>>> Turbine, Torque, your pull tool or screen class - and Velocity should
>>>  be
>>> able to access it and work with it provided that you have somehow made
>>>   it
>>> available to the context.
>>> 
>>> One thing you can't do in velocity (and shouldn't be able to do) is
>>> instantiate non-primitives (other than String).  You can create
>>> references
>>> to objects, arrays, Strings and ints using #set.
>>> 
>>> BTW: You may like to use ArrayList in preference to Vector.
>>> 
>>> HTH,
>>> 
>>> Scott
>>> --
>>> Scott Eade
>>> Backstage Technologies Pty. Ltd.
>>> http://www.backstagetech.com.au
>>> .Mac Chat/AIM: seade at mac dot com
>>> 
>>> 
>>> On 31/12/2002 10:56 AM, "Eigen Technology Pty Ltd"
>>> <mi...@eigentechnology.com> wrote:
>>> 
>>>> Thanks for the advice,
>>>> 
>>>> I knew the Pull Tool part. But my question was on how to create a
>>>> Vector
>>>> in this PullTool.
>>>> 
>>>> Say you have 100 rows of data each with 6 cols in your
>>>> 
>>>> $DateTool.TodaysDate()
>>>> 
>>>> function. Before you pass it to Velocity, you have to package them in
>>>>   a
>>>> Vector first, right (correct me if I am wrong)? If this vector is not
>>>>   from
>>>> Turbine, how do you create it?
>>>> 
>>>> cheers
>>>> michael
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> 
>>>>> you have to configure your TR.properties file. Configure the pull
>>>>> service by adding a line like
>>>>> 
>>>>> services.PullService.tool.<scope>.<id> = <classname>
>>>>> 
>>>>> for example:
>>>>> 
>>>>> services.PullService.tool.request.date=com.clavie.myEvents.tool.DateT
>>>>>  ool
>>>>> 
>>>>> then, you should be able to access it in Velocity with sth like:
>>>>> $DateTool.TodaysDate()
>>>>> 
>>>>> David
>>>>> 
>>>>> On Monday, December 30, 2002, at 03:37  PM, Eigen Technology Pty Ltd
>>>>> wrote:
>>>>> 
>>>>>> When Turbine extract data from a database, it creates a Vector and
>>>>>> returns
>>>>>> for Velocity to display.
>>>>>> 
>>>>>> If I want to write a Java Utility, some tabulated calculated
>>>>>> results are
>>>>>> to be passed on to Velocity, i.e. Vectors not created by Turbine,
>>>>>> how
>>>>>> should I do it.
>>>>>> 
>>>>>> I tried:
>>>>>> 
>>>>>> Vector TEST=null;
>>>>>> 
>>>>>> etc....
>>>>>> 
>>>>>> for(i=0; i < somelimit; ++i) {
>>>>>> TEST.add(someobject(i));
>>>>>> }
>>>>>> etc....
>>>>>> 
>>>>>> return TEST;
>>>>>> 
>>>>>> Velocity displays nothing, help is much appreciated.
>>>>>> 
>>>>>> michael
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> --
>>>>>> To unsubscribe, e-mail:
>>>>>> <ma...@jakarta.apache.org>
>>>>>> For additional commands, e-mail:
>>>>>> <ma...@jakarta.apache.org>
>>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> To unsubscribe, e-mail:
>>>>> <ma...@jakarta.apache.org> For additional
>>>>> commands, e-mail: <ma...@jakarta.apache.org>
>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> To unsubscribe, e-mail:
>>>> <ma...@jakarta.apache.org>
>>>> For additional commands, e-mail:
>>>> <ma...@jakarta.apache.org>
>>>> 
>>> 
>>> 
>>> --
>>> To unsubscribe, e-mail:
>>> <ma...@jakarta.apache.org>
>>> For additional commands, e-mail:
>>> <ma...@jakarta.apache.org>
>>> 
>> 
>> 
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org> For additional
>> commands, e-mail: <ma...@jakarta.apache.org>
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Howto create a VECTOR for Velocity

Posted by Eigen Technology Pty Ltd <mi...@eigentechnology.com>.
Well, the reason I raised the question was because I tried and failed
using arrays, lists etc when passon to Velocity, i.e.

context.put("entry", some_list/some_array);
have FAILED.

This is what I did:

1. I have a Vector A;   <------ context.put("entry", A) is OK with Velocity.
2. But I need to do some work on the data in A. So:
3. Extract Object a = A.elementAt(some_position); Do what I have to do AND:
4. Put it back into another Vector B.
   B.add(modified_a);
   context.put("entry", B);

BUT velocity does not like it.

I tried to vary Vector B with Array B, List B, nothing worked, anyone know
where I have done wrong?

cheers
michael






>
> or you could probably use an array of an array directly.
>
> On Monday, December 30, 2002, at 04:24  PM, Scott Eade wrote:
>
>> Michael,
>>
>> Most people on this list will argue strongly that your velocity
>> templates
>> should contain only formatting code and never processing code - put
>> this
>> instead in a pull tool or the screen classes.
>>
>> Provide a method in your pull tool that provides the data you need -
>> this
>> might instantiate and populate a Vector or whatever else you want to
>> do.
>>
>> I don't really understand the specific example you are attempting to
>> describe below, but an object is an object, whether it is created by
>> Turbine, Torque, your pull tool or screen class - and Velocity should
>>  be
>> able to access it and work with it provided that you have somehow made
>>   it
>> available to the context.
>>
>> One thing you can't do in velocity (and shouldn't be able to do) is
>> instantiate non-primitives (other than String).  You can create
>> references
>> to objects, arrays, Strings and ints using #set.
>>
>> BTW: You may like to use ArrayList in preference to Vector.
>>
>> HTH,
>>
>> Scott
>> --
>> Scott Eade
>> Backstage Technologies Pty. Ltd.
>> http://www.backstagetech.com.au
>> .Mac Chat/AIM: seade at mac dot com
>>
>>
>> On 31/12/2002 10:56 AM, "Eigen Technology Pty Ltd"
>> <mi...@eigentechnology.com> wrote:
>>
>>> Thanks for the advice,
>>>
>>> I knew the Pull Tool part. But my question was on how to create a
>>> Vector
>>> in this PullTool.
>>>
>>> Say you have 100 rows of data each with 6 cols in your
>>>
>>> $DateTool.TodaysDate()
>>>
>>> function. Before you pass it to Velocity, you have to package them in
>>>   a
>>> Vector first, right (correct me if I am wrong)? If this vector is not
>>>   from
>>> Turbine, how do you create it?
>>>
>>> cheers
>>> michael
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>>
>>>> you have to configure your TR.properties file. Configure the pull
>>>> service by adding a line like
>>>>
>>>> services.PullService.tool.<scope>.<id> = <classname>
>>>>
>>>> for example:
>>>>
>>>> services.PullService.tool.request.date=com.clavie.myEvents.tool.DateT
>>>>  ool
>>>>
>>>> then, you should be able to access it in Velocity with sth like:
>>>> $DateTool.TodaysDate()
>>>>
>>>> David
>>>>
>>>> On Monday, December 30, 2002, at 03:37  PM, Eigen Technology Pty Ltd
>>>> wrote:
>>>>
>>>>> When Turbine extract data from a database, it creates a Vector and
>>>>> returns
>>>>> for Velocity to display.
>>>>>
>>>>> If I want to write a Java Utility, some tabulated calculated
>>>>> results are
>>>>> to be passed on to Velocity, i.e. Vectors not created by Turbine,
>>>>> how
>>>>> should I do it.
>>>>>
>>>>> I tried:
>>>>>
>>>>> Vector TEST=null;
>>>>>
>>>>> etc....
>>>>>
>>>>> for(i=0; i < somelimit; ++i) {
>>>>> TEST.add(someobject(i));
>>>>> }
>>>>> etc....
>>>>>
>>>>> return TEST;
>>>>>
>>>>> Velocity displays nothing, help is much appreciated.
>>>>>
>>>>> michael
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> To unsubscribe, e-mail:
>>>>> <ma...@jakarta.apache.org>
>>>>> For additional commands, e-mail:
>>>>> <ma...@jakarta.apache.org>
>>>>>
>>>>
>>>>
>>>> --
>>>> To unsubscribe, e-mail:
>>>> <ma...@jakarta.apache.org> For additional
>>>> commands, e-mail: <ma...@jakarta.apache.org>
>>>
>>>
>>>
>>>
>>> --
>>> To unsubscribe, e-mail:
>>> <ma...@jakarta.apache.org>
>>> For additional commands, e-mail:
>>> <ma...@jakarta.apache.org>
>>>
>>
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
>>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org> For additional
> commands, e-mail: <ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Howto create a VECTOR for Velocity

Posted by David Worms <da...@simpledesign.com>.
or you could probably use an array of an array directly.

On Monday, December 30, 2002, at 04:24  PM, Scott Eade wrote:

> Michael,
>
> Most people on this list will argue strongly that your velocity  
> templates
> should contain only formatting code and never processing code - put  
> this
> instead in a pull tool or the screen classes.
>
> Provide a method in your pull tool that provides the data you need -  
> this
> might instantiate and populate a Vector or whatever else you want to  
> do.
>
> I don't really understand the specific example you are attempting to
> describe below, but an object is an object, whether it is created by
> Turbine, Torque, your pull tool or screen class - and Velocity should  
> be
> able to access it and work with it provided that you have somehow made  
> it
> available to the context.
>
> One thing you can't do in velocity (and shouldn't be able to do) is
> instantiate non-primitives (other than String).  You can create  
> references
> to objects, arrays, Strings and ints using #set.
>
> BTW: You may like to use ArrayList in preference to Vector.
>
> HTH,
>
> Scott
> --  
> Scott Eade
> Backstage Technologies Pty. Ltd.
> http://www.backstagetech.com.au
> .Mac Chat/AIM: seade at mac dot com
>
>
> On 31/12/2002 10:56 AM, "Eigen Technology Pty Ltd"
> <mi...@eigentechnology.com> wrote:
>
>> Thanks for the advice,
>>
>> I knew the Pull Tool part. But my question was on how to create a  
>> Vector
>> in this PullTool.
>>
>> Say you have 100 rows of data each with 6 cols in your
>>
>> $DateTool.TodaysDate()
>>
>> function. Before you pass it to Velocity, you have to package them in  
>> a
>> Vector first, right (correct me if I am wrong)? If this vector is not  
>> from
>> Turbine, how do you create it?
>>
>> cheers
>> michael
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>>
>>> you have to configure your TR.properties file. Configure the pull
>>> service by adding a line like
>>>
>>> services.PullService.tool.<scope>.<id> = <classname>
>>>
>>> for example:
>>>
>>> services.PullService.tool.request.date=com.clavie.myEvents.tool.DateT 
>>> ool
>>>
>>> then, you should be able to access it in Velocity with sth like:
>>> $DateTool.TodaysDate()
>>>
>>> David
>>>
>>> On Monday, December 30, 2002, at 03:37  PM, Eigen Technology Pty Ltd
>>> wrote:
>>>
>>>> When Turbine extract data from a database, it creates a Vector and
>>>> returns
>>>> for Velocity to display.
>>>>
>>>> If I want to write a Java Utility, some tabulated calculated results
>>>> are
>>>> to be passed on to Velocity, i.e. Vectors not created by Turbine,  
>>>> how
>>>> should I do it.
>>>>
>>>> I tried:
>>>>
>>>> Vector TEST=null;
>>>>
>>>> etc....
>>>>
>>>> for(i=0; i < somelimit; ++i) {
>>>> TEST.add(someobject(i));
>>>> }
>>>> etc....
>>>>
>>>> return TEST;
>>>>
>>>> Velocity displays nothing, help is much appreciated.
>>>>
>>>> michael
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> To unsubscribe, e-mail:
>>>> <ma...@jakarta.apache.org>
>>>> For additional commands, e-mail:
>>>> <ma...@jakarta.apache.org>
>>>>
>>>
>>>
>>> --
>>> To unsubscribe, e-mail:
>>> <ma...@jakarta.apache.org> For additional
>>> commands, e-mail: <ma...@jakarta.apache.org>
>>
>>
>>
>>
>> --
>> To unsubscribe, e-mail:    
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:  
>> <ma...@jakarta.apache.org>
>>
>
>
> --
> To unsubscribe, e-mail:    
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:  
> <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Howto create a VECTOR for Velocity

Posted by Scott Eade <se...@backstagetech.com.au>.
Michael,

Most people on this list will argue strongly that your velocity templates
should contain only formatting code and never processing code - put this
instead in a pull tool or the screen classes.

Provide a method in your pull tool that provides the data you need - this
might instantiate and populate a Vector or whatever else you want to do.

I don't really understand the specific example you are attempting to
describe below, but an object is an object, whether it is created by
Turbine, Torque, your pull tool or screen class - and Velocity should be
able to access it and work with it provided that you have somehow made it
available to the context.

One thing you can't do in velocity (and shouldn't be able to do) is
instantiate non-primitives (other than String).  You can create references
to objects, arrays, Strings and ints using #set.

BTW: You may like to use ArrayList in preference to Vector.

HTH,

Scott
-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au
.Mac Chat/AIM: seade at mac dot com
 

On 31/12/2002 10:56 AM, "Eigen Technology Pty Ltd"
<mi...@eigentechnology.com> wrote:

> Thanks for the advice,
> 
> I knew the Pull Tool part. But my question was on how to create a Vector
> in this PullTool.
> 
> Say you have 100 rows of data each with 6 cols in your
> 
> $DateTool.TodaysDate()
> 
> function. Before you pass it to Velocity, you have to package them in a
> Vector first, right (correct me if I am wrong)? If this vector is not from
> Turbine, how do you create it?
> 
> cheers
> michael
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>> 
>> you have to configure your TR.properties file. Configure the pull
>> service by adding a line like
>> 
>> services.PullService.tool.<scope>.<id> = <classname>
>> 
>> for example:
>> 
>> services.PullService.tool.request.date=com.clavie.myEvents.tool.DateTool
>> 
>> then, you should be able to access it in Velocity with sth like:
>> $DateTool.TodaysDate()
>> 
>> David
>> 
>> On Monday, December 30, 2002, at 03:37  PM, Eigen Technology Pty Ltd
>> wrote:
>> 
>>> When Turbine extract data from a database, it creates a Vector and
>>> returns
>>> for Velocity to display.
>>> 
>>> If I want to write a Java Utility, some tabulated calculated results
>>> are
>>> to be passed on to Velocity, i.e. Vectors not created by Turbine, how
>>> should I do it.
>>> 
>>> I tried:
>>> 
>>> Vector TEST=null;
>>> 
>>> etc....
>>> 
>>> for(i=0; i < somelimit; ++i) {
>>> TEST.add(someobject(i));
>>> }
>>> etc....
>>> 
>>> return TEST;
>>> 
>>> Velocity displays nothing, help is much appreciated.
>>> 
>>> michael
>>> 
>>> 
>>> 
>>> 
>>> --
>>> To unsubscribe, e-mail:
>>> <ma...@jakarta.apache.org>
>>> For additional commands, e-mail:
>>> <ma...@jakarta.apache.org>
>>> 
>> 
>> 
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org> For additional
>> commands, e-mail: <ma...@jakarta.apache.org>
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Howto create a VECTOR for Velocity

Posted by David Worms <da...@simpledesign.com>.
hum, not sure what you mean by "this vector is not from Turbine". You  
can get the contents of your vector from Turbine, directly from a  
database, or anywhere else. Can you give me more infos?


On Monday, December 30, 2002, at 03:56  PM, Eigen Technology Pty Ltd  
wrote:

> Thanks for the advice,
>
> I knew the Pull Tool part. But my question was on how to create a  
> Vector
> in this PullTool.
>
> Say you have 100 rows of data each with 6 cols in your
>
> $DateTool.TodaysDate()
>
> function. Before you pass it to Velocity, you have to package them in a
> Vector first, right (correct me if I am wrong)? If this vector is not  
> from
> Turbine, how do you create it?
>
> cheers
> michael
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>>
>> you have to configure your TR.properties file. Configure the pull
>> service by adding a line like
>>
>> services.PullService.tool.<scope>.<id> = <classname>
>>
>> for example:
>>
>> services.PullService.tool.request.date=com.clavie.myEvents.tool.DateTo 
>> ol
>>
>> then, you should be able to access it in Velocity with sth like:
>> $DateTool.TodaysDate()
>>
>> David
>>
>> On Monday, December 30, 2002, at 03:37  PM, Eigen Technology Pty Ltd
>> wrote:
>>
>>> When Turbine extract data from a database, it creates a Vector and
>>> returns
>>> for Velocity to display.
>>>
>>> If I want to write a Java Utility, some tabulated calculated results
>>> are
>>> to be passed on to Velocity, i.e. Vectors not created by Turbine, how
>>> should I do it.
>>>
>>> I tried:
>>>
>>> Vector TEST=null;
>>>
>>> etc....
>>>
>>> for(i=0; i < somelimit; ++i) {
>>> TEST.add(someobject(i));
>>> }
>>> etc....
>>>
>>> return TEST;
>>>
>>> Velocity displays nothing, help is much appreciated.
>>>
>>> michael
>>>
>>>
>>>
>>>
>>> --
>>> To unsubscribe, e-mail:
>>> <ma...@jakarta.apache.org>
>>> For additional commands, e-mail:
>>> <ma...@jakarta.apache.org>
>>>
>>
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org> For additional
>> commands, e-mail: <ma...@jakarta.apache.org>
>
>
>
>
> --
> To unsubscribe, e-mail:    
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:  
> <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Howto create a VECTOR for Velocity

Posted by Eigen Technology Pty Ltd <mi...@eigentechnology.com>.
Thanks for the advice,

I knew the Pull Tool part. But my question was on how to create a Vector
in this PullTool.

Say you have 100 rows of data each with 6 cols in your

$DateTool.TodaysDate()

function. Before you pass it to Velocity, you have to package them in a
Vector first, right (correct me if I am wrong)? If this vector is not from
Turbine, how do you create it?

cheers
michael

















>
> you have to configure your TR.properties file. Configure the pull
> service by adding a line like
>
> services.PullService.tool.<scope>.<id> = <classname>
>
> for example:
>
> services.PullService.tool.request.date=com.clavie.myEvents.tool.DateTool
>
> then, you should be able to access it in Velocity with sth like:
> $DateTool.TodaysDate()
>
> David
>
> On Monday, December 30, 2002, at 03:37  PM, Eigen Technology Pty Ltd
> wrote:
>
>> When Turbine extract data from a database, it creates a Vector and
>> returns
>> for Velocity to display.
>>
>> If I want to write a Java Utility, some tabulated calculated results
>> are
>> to be passed on to Velocity, i.e. Vectors not created by Turbine, how
>> should I do it.
>>
>> I tried:
>>
>> Vector TEST=null;
>>
>> etc....
>>
>> for(i=0; i < somelimit; ++i) {
>> TEST.add(someobject(i));
>> }
>> etc....
>>
>> return TEST;
>>
>> Velocity displays nothing, help is much appreciated.
>>
>> michael
>>
>>
>>
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
>>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org> For additional
> commands, e-mail: <ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Howto create a VECTOR for Velocity

Posted by David Worms <da...@simpledesign.com>.
you have to configure your TR.properties file. Configure the pull 
service by adding a line like

services.PullService.tool.<scope>.<id> = <classname>

for example:

services.PullService.tool.request.date=com.clavie.myEvents.tool.DateTool

then, you should be able to access it in Velocity with sth like: 
$DateTool.TodaysDate()

David

On Monday, December 30, 2002, at 03:37  PM, Eigen Technology Pty Ltd 
wrote:

> When Turbine extract data from a database, it creates a Vector and 
> returns
> for Velocity to display.
>
> If I want to write a Java Utility, some tabulated calculated results 
> are
> to be passed on to Velocity, i.e. Vectors not created by Turbine, how
> should I do it.
>
> I tried:
>
> Vector TEST=null;
>
> etc....
>
> for(i=0; i < somelimit; ++i) {
> TEST.add(someobject(i));
> }
> etc....
>
> return TEST;
>
> Velocity displays nothing, help is much appreciated.
>
> michael
>
>
>
>
> --
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Howto create a VECTOR for Velocity

Posted by Eigen Technology Pty Ltd <mi...@eigentechnology.com>.
When Turbine extract data from a database, it creates a Vector and returns
for Velocity to display.

If I want to write a Java Utility, some tabulated calculated results are
to be passed on to Velocity, i.e. Vectors not created by Turbine, how
should I do it.

I tried:

Vector TEST=null;

etc....

for(i=0; i < somelimit; ++i) {
TEST.add(someobject(i));
}
etc....

return TEST;

Velocity displays nothing, help is much appreciated.

michael




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: A Java Question... not working.

Posted by Scott Eade <se...@backstagetech.com.au>.
On 28/12/2002 10:04 AM, "Eigen Technology Pty Ltd"
<mi...@eigentechnology.com> wrote:

> it might help if I would be allowed to have a
> look at the Turbine's source code.

http://cvs.apache.org/viewcvs/jakarta-turbine-2/

Cheers,

Scott
-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au
.Mac Chat/AIM: seade at mac dot com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: A Java Question... not working.

Posted by Eigen Technology Pty Ltd <mi...@eigentechnology.com>.
I guess this question can be addressed by the author of Turbine :-). 
Since we can extract data by doing:

$document.XXX in .vm

the author must have a way of extracting data from the $document object.
Since I can't extract the data using my methods (and/or all those who has
offered me assisstance), it might help if I would be allowed to have a
look at the Turbine's source code.

thanks
michael



> Thanks to all,
>
> I have tried all that suggested, unfortunately none worked ... What Wei
> has suggested compiles OK, but nothing got returned. Here is my
> procedure again:
>
> 1. Extract data from DB using a PullTool
> 2. Data is encapsulated in a Vector.
> 3. Each element in this Vector contains a single row of data (multiple
> col). 4. Try to extract a single col of datum from a single row.
>
> The first time when I perform the elementAt(1), it is OK, it returns a
> list of Objects. I can get Velocity to display its contents by
>
> $documents.XXX
>
> If I perform toString() on these objects, I get only the Address of the
> objects. If I perform another elementAt(x), nothing got returned. I am a
> bit confused here, how is object-strings converted in general?
>
> thanks
> michael
>
>
>
>
>
>
>
>>
>> Your right hand side is an Object, you need to do a cast.  That is:
>>
>> String test = (String)((Object)docs.elementAt(1)).elementAt(1);
>>
>> or
>>
>> String test = ((Doc)docs.get(1)).getDocString();
>>
>> or
>>
>> String test = (docs.elementAt(1)).elementAt(1).toString();
>>
>> It depends on the type you have for the first field in your doc
>> object.
>>   If it is a BigDecimal, direct cast may not work, toString() will do.
>> You see my point.
>>
>> Hope this helps.
>>
>> Eigen Technology Pty Ltd wrote:
>>> I could possibly write a servlet to extract and then filter the data,
>>> but I think that would defeat the purpose of having Turbine in the
>>> first place.
>>>
>>> I tried:
>>>
>>>  String test = ((Object)docs.elementAt(1)).elementAt(1);
>>>  return test;
>>>
>>> the compiler did not complain, but Velocity rejected it. Really
>>> running out of ideas. Any suggestion would be appreciated.
>>>
>>> cheers
>>> michael
>>>
>>>
>>>
>>>
>>>>I have a db Table consisting of 10 (say col_A, col_B, col_C, col_D,
>>>> ... col_J) columns.  After accessing these data using a PullTool (as
>>>> suggested by Scott and Peter), I stored them in a Vector/List.
>>>> Before I display them in my .vm file, I want to perform some
>>>> filtering, e.g. select col_A = "some_Text".
>>>>
>>>>The question is:
>>>>
>>>>I can extract what is in the Vector as Objects which has all ten
>>>> columns in it, it returns a certain address. But How do I get data
>>>> in col_A out and perform the filtering I intended to do?
>>>>
>>>>best wishes
>>>>michael
>>>>
>>>>
>>>>
>>>>--
>>>>To unsubscribe, e-mail:
>>>><ma...@jakarta.apache.org> For additional
>>>> commands, e-mail: <ma...@jakarta.apache.org>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> To unsubscribe, e-mail:
>>> <ma...@jakarta.apache.org> For additional
>>> commands, e-mail: <ma...@jakarta.apache.org>
>>>
>>
>>
>> --
>> Wei He
>> Email: weihe@optonline.net
>>
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org> For additional
>> commands, e-mail: <ma...@jakarta.apache.org>
>
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org> For additional
> commands, e-mail: <ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: A Java Question... not working.

Posted by Eigen Technology Pty Ltd <mi...@eigentechnology.com>.
Wei,

I tried

$document.getClass().getName()

it just return with the path to one of my class files:

org.mycompany.medici.om.Contact

where Contact is the name of the Database Table. What does this mean?

cheers
michael





>
> I think the last resort is to find out what the objects really are. This
>  can be done by using getClass().getName() on each Object in your
> Collection.  This can be done in vm file, and class name of each Object
> will be printed.
>
> Once you find out what they are and call their own methods to get the
> fields you need.  Hope this helps.
>
> Eigen Technology Pty Ltd wrote:
>> Thanks to all,
>>
>> I have tried all that suggested, unfortunately none worked ... What
>> Wei has suggested compiles OK, but nothing got returned. Here is my
>> procedure again:
>>
>> 1. Extract data from DB using a PullTool
>> 2. Data is encapsulated in a Vector.
>> 3. Each element in this Vector contains a single row of data (multiple
>> col). 4. Try to extract a single col of datum from a single row.
>>
>> The first time when I perform the elementAt(1), it is OK, it returns a
>> list of Objects. I can get Velocity to display its contents by
>>
>> $documents.XXX
>>
>> If I perform toString() on these objects, I get only the Address of
>> the objects. If I perform another elementAt(x), nothing got returned.
>> I am a bit confused here, how is object-strings converted in general?
>>
>> thanks
>> michael
>>
>>
>>
>>
>>
>>
>>
>>
>>>Your right hand side is an Object, you need to do a cast.  That is:
>>>
>>>String test = (String)((Object)docs.elementAt(1)).elementAt(1);
>>>
>>>or
>>>
>>>String test = ((Doc)docs.get(1)).getDocString();
>>>
>>>or
>>>
>>>String test = (docs.elementAt(1)).elementAt(1).toString();
>>>
>>>It depends on the type you have for the first field in your doc
>>> object.
>>>  If it is a BigDecimal, direct cast may not work, toString() will do.
>>>You see my point.
>>>
>>>Hope this helps.
>>>
>>>Eigen Technology Pty Ltd wrote:
>>>
>>>>I could possibly write a servlet to extract and then filter the data,
>>>> but I think that would defeat the purpose of having Turbine in the
>>>> first place.
>>>>
>>>>I tried:
>>>>
>>>> String test = ((Object)docs.elementAt(1)).elementAt(1);
>>>> return test;
>>>>
>>>>the compiler did not complain, but Velocity rejected it. Really
>>>> running out of ideas. Any suggestion would be appreciated.
>>>>
>>>>cheers
>>>>michael
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>I have a db Table consisting of 10 (say col_A, col_B, col_C, col_D,
>>>>> ... col_J) columns.  After accessing these data using a PullTool (as
>>>>> suggested by Scott and Peter), I stored them in a Vector/List.
>>>>> Before I display them in my .vm file, I want to perform some
>>>>> filtering, e.g. select col_A = "some_Text".
>>>>>
>>>>>The question is:
>>>>>
>>>>>I can extract what is in the Vector as Objects which has all ten
>>>>> columns in it, it returns a certain address. But How do I get data
>>>>> in col_A out and perform the filtering I intended to do?
>>>>>
>>>>>best wishes
>>>>>michael
>>>>>
>>>>>
>>>>>
>>>>>--
>>>>>To unsubscribe, e-mail:
>>>>><ma...@jakarta.apache.org> For additional
>>>>> commands, e-mail: <ma...@jakarta.apache.org>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>--
>>>>To unsubscribe, e-mail:
>>>><ma...@jakarta.apache.org> For additional
>>>> commands, e-mail: <ma...@jakarta.apache.org>
>>>>
>>>
>>>--
>>>Wei He
>>>Email: weihe@optonline.net
>>>
>>>
>>>--
>>>To unsubscribe, e-mail:
>>><ma...@jakarta.apache.org> For additional
>>> commands, e-mail: <ma...@jakarta.apache.org>
>>
>>
>>
>>
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org> For additional
>> commands, e-mail: <ma...@jakarta.apache.org>
>>
>
>
> --
> Wei He, Ph.D.
> Email: weihe@optonline.net
> Voice: (845)359-5621
> Fax:   (845)359-1631
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org> For additional
> commands, e-mail: <ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: A Java Question... not working.

Posted by Wei He <we...@ldeo.columbia.edu>.
I think the last resort is to find out what the objects really are. This 
can be done by using getClass().getName() on each Object in your 
Collection.  This can be done in vm file, and class name of each Object 
will be printed.

Once you find out what they are and call their own methods to get the 
fields you need.  Hope this helps.

Eigen Technology Pty Ltd wrote:
> Thanks to all,
> 
> I have tried all that suggested, unfortunately none worked ... What Wei
> has suggested compiles OK, but nothing got returned. Here is my procedure
> again:
> 
> 1. Extract data from DB using a PullTool
> 2. Data is encapsulated in a Vector.
> 3. Each element in this Vector contains a single row of data (multiple col).
> 4. Try to extract a single col of datum from a single row.
> 
> The first time when I perform the elementAt(1), it is OK, it returns a
> list of Objects. I can get Velocity to display its contents by
> 
> $documents.XXX
> 
> If I perform toString() on these objects, I get only the Address of the
> objects. If I perform another elementAt(x), nothing got returned. I am a
> bit confused here, how is object-strings converted in general?
> 
> thanks
> michael
> 
> 
> 
> 
> 
> 
> 
> 
>>Your right hand side is an Object, you need to do a cast.  That is:
>>
>>String test = (String)((Object)docs.elementAt(1)).elementAt(1);
>>
>>or
>>
>>String test = ((Doc)docs.get(1)).getDocString();
>>
>>or
>>
>>String test = (docs.elementAt(1)).elementAt(1).toString();
>>
>>It depends on the type you have for the first field in your doc object.
>>  If it is a BigDecimal, direct cast may not work, toString() will do.
>>You see my point.
>>
>>Hope this helps.
>>
>>Eigen Technology Pty Ltd wrote:
>>
>>>I could possibly write a servlet to extract and then filter the data,
>>>but I think that would defeat the purpose of having Turbine in the
>>>first place.
>>>
>>>I tried:
>>>
>>> String test = ((Object)docs.elementAt(1)).elementAt(1);
>>> return test;
>>>
>>>the compiler did not complain, but Velocity rejected it. Really
>>>running out of ideas. Any suggestion would be appreciated.
>>>
>>>cheers
>>>michael
>>>
>>>
>>>
>>>
>>>
>>>>I have a db Table consisting of 10 (say col_A, col_B, col_C, col_D,
>>>>... col_J) columns.  After accessing these data using a PullTool (as
>>>>suggested by Scott and Peter), I stored them in a Vector/List. Before
>>>>I display them in my .vm file, I want to perform some filtering, e.g.
>>>>select col_A = "some_Text".
>>>>
>>>>The question is:
>>>>
>>>>I can extract what is in the Vector as Objects which has all ten
>>>>columns in it, it returns a certain address. But How do I get data in
>>>>col_A out and perform the filtering I intended to do?
>>>>
>>>>best wishes
>>>>michael
>>>>
>>>>
>>>>
>>>>--
>>>>To unsubscribe, e-mail:
>>>><ma...@jakarta.apache.org> For additional
>>>>commands, e-mail: <ma...@jakarta.apache.org>
>>>
>>>
>>>
>>>
>>>
>>>--
>>>To unsubscribe, e-mail:
>>><ma...@jakarta.apache.org> For additional
>>>commands, e-mail: <ma...@jakarta.apache.org>
>>>
>>
>>--
>>Wei He
>>Email: weihe@optonline.net
>>
>>
>>--
>>To unsubscribe, e-mail:
>><ma...@jakarta.apache.org> For additional
>>commands, e-mail: <ma...@jakarta.apache.org>
> 
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


-- 
Wei He, Ph.D.
Email: weihe@optonline.net
Voice: (845)359-5621
Fax:   (845)359-1631


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>