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: >>>><mailto:[EMAIL PROTECTED]> For additional >>>> commands, e-mail: <mailto:[EMAIL PROTECTED]> >>> >>> >>> >>> >>> >>> -- >>> To unsubscribe, e-mail: >>> <mailto:[EMAIL PROTECTED]> For additional >>> commands, e-mail: <mailto:[EMAIL PROTECTED]> >>> >> >> >> -- >> Wei He >> Email: [EMAIL PROTECTED] >> >> >> -- >> To unsubscribe, e-mail: >> <mailto:[EMAIL PROTECTED]> For additional >> commands, e-mail: <mailto:[EMAIL PROTECTED]> > > > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> For additional > commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
