I have tried using setQuery within the Javascript as;

<!DOCTYPE html>
<html>
<head>
<title>Table Query Wrapper Example</title>
<script type="text/javascript" src="http://www.google.com/jsapi";></
script>
<script type="text/javascript" src="tablequerywrapper.js"></script>
<script type="text/javascript">
    google.load('visualization', '1', {'packages' : ['table']});
    google.setOnLoadCallback(init);
    var dataSourceUrl ='http://localhost:8080/visualRSS/
SQLDataSource';
    //var dataSourceUrl = 'http://spreadsheets.google.com/tq?
key=rh_6pF1K_XsruwVr_doofvw&pub=1';
    var query, options, container;

    function init() {
      query = new google.visualization.Query(dataSourceUrl);
      query.setQuery('select UserNo');
      container = document.getElementById("table");
      options = {'pageSize': 5};
      sendAndDraw();
    }

    function sendAndDraw() {
              query.abort();
              var tableQueryWrapper = new TableQueryWrapper(query, container,
options);
              tableQueryWrapper.sendAndDraw();
    }

    function setOption(prop, value) {
      options[prop] = value;
      sendAndDraw();
    }

  </script>

but I still get the whole table back as a result.

any ideas?

I don;t seem to be able to override the query object in the servlet.

On Aug 2, 10:51 am, Badtnik <[email protected]> wrote:
> Sorry, I meant in the servlet java code, I see you use a query object. That
> query object can be assinged with a select clause using setQuery:
>
> @Override
>  public DataTable generateDataTable(Query *query*, HttpServletRequest
> request)
>      throws DataSourceException {
>   SqlDatabaseDescription dbDescription = new SqlDatabaseDescription(
>            "jdbc:mysql://localhost:3306/myApp",
>
>        "root", "password","table");
>
>    return SqlDataSourceHelper.executeQuery(query, dbDescription);
>  }
>
> did you try that?
>
>
>
> On Mon, Aug 2, 2010 at 12:23 PM, MartinOShea <[email protected]> wrote:
> > Neither appears to and all the other Google code is unchanged. I would
> > be really grateful for any advise on this as it is really quite
> > frustrating.
>
> > On Aug 2, 10:22 am, MartinOShea <[email protected]> wrote:
> > > But neither does so.
>
> > > On Aug 2, 10:19 am, Oded Badt <[email protected]> wrote:
>
> > > > Both would work, depends what better fits your requirement.
> > > >   Badtnik
>
> > > > On Mon, Aug 2, 2010 at 12:11 PM, MartinOShea <[email protected]>
> > wrote:
> > > > > But where do I apply query overrides? In the SetQuery as follows in a
> > > > > webpage / JSP:
>
> > > > > function init() {
> > > > >      query = new google.visualization.Query(dataSourceUrl);
> > > > >      query.setQuery('select UserName, DiaryEventCode from Diary where
> > > > > DiaryEventCode = "ADM_11"');
> > > > >      container = document.getElementById("table");
> > > > >      options = {'pageSize': 5};
> > > > >      sendAndDraw();
> > > > >    }
>
> > > > > Or in the tableQuerywrapper.js code using:
>
> > > > >  this.table = new google.visualization.Table(container);
>
> > > > >  this.query = query;
> > > > >  this.selectQueryClause = 'whatever';
> > > > >  this.sortQueryClause = '';
> > > > >  this.pageQueryClause = '';
> > > > >  this.container = container;
> > > > >  this.currentDataTable = null
>
> > > > > On Aug 2, 10:04 am, Badtnik <[email protected]> wrote:
> > > > > > I see.
> > > > > > Not sure this'll solve your problem, buy you might want to use a
> > select
> > > > > > clause in your query.
> > > > > > See:
>
> >http://code.google.com/apis/visualization/documentation/querylanguage...
>
> > > > > >   Badtnik
>
> > > > > > On Mon, Aug 2, 2010 at 11:09 AM, MartinOShea <
> > [email protected]>
> > > > > wrote:
> > > > > > > Or do I need to construct a query via the capabilities element of
> > the
> > > > > > > SQLDataSourceServlet?
>
> > > > > > > On Aug 2, 7:29 am, Badtnik <[email protected]> wrote:
> > > > > > > > Hello Martin
>
> > > > > > > > Did you have a look at the DataView table wrapper?
>
> >http://code.google.com/apis/visualization/documentation/reference.htm.
> > > > > ..
>
> > > > > > > > <
> > > > >http://code.google.com/apis/visualization/documentation/reference.htm
> > ..
> > > > > > > .>
> > > > > > > >   Badtnik
>
> > > > > > > > On Mon, Aug 2, 2010 at 1:41 AM, MartinOShea <
> > [email protected]>
> > > > > > > wrote:
> > > > > > > > > Hello
>
> > > > > > > > > I've used the Table Query Wrapper Example code at:
>
> > > > > > > > >http://code.google.com/apis/visualization/docu['default'],
> > > > > > > mentation/examples.html#tablequerywrapper<
>
> >http://code.google.com/apis/visualization/documentation/examples.html..
> > > > > .>
>
> > > > > > > > > To retreieve data from a table in a MySQL database by using a
> > URL
> > > > > as
> > > > > > > > > follows:
>
> > > > > > > > > var dataSourceUrl ='
> >http://localhost:8080/myApp/SQLDataSource';
>
> > > > > > > > > And hardcoding the connection parameters in the
> > > > > SQLDataSourceServlet
> > > > > > > > > provided in the downloadable examples. So, in the servlet, I
> > have
> > > > > > > > > code:
>
> > > > > > > > > �...@override
> > > > > > > > >  public DataTable generateDataTable(Query query,
> > HttpServletRequest
> > > > > > > > > request)
> > > > > > > > >      throws DataSourceException {
> > > > > > > > >   SqlDatabaseDescription dbDescription = new
> > > > > SqlDatabaseDescription(
> > > > > > > > >            "jdbc:mysql://localhost:3306/myApp",
>
> > > > > > > > >        "root", "password","table");
>
> > > > > > > > >    return SqlDataSourceHelper.executeQuery(query,
> > dbDescription);
> > > > > > > > >  }
>
> > > > > > > > > Rather than taking these values from the parameter string of
> > the
> > > > > URL.
> > > > > > > > > This works fine and displays the table on the web page. But,
> > it
> > > > > gives
> > > > > > > > > me all the columns of the targeted table whereas I need to be
> > able
> > > > > to
> > > > > > > > > display only a subset of the columns.
>
> > > > > > > > > I can see nowhere where this might be done though; I have
> > added
> > > > > > > > > parameters to the URL's query string using the tq instruction
> > and
> > > > > have
> > > > > > > > > tried changing the Javascript in the tablequerywrapper.js
> > file. But
> > > > > > > > > the result is always the full table.
>
> > > > > > > > > Can anyone suggest what I might be doing wrong or not doing?
>
> > > > > > > > > Thanks
>
> > > > > > > > > Martin O'Shea.
>
> > > > > > > > > --
> > > > > > > > > You received this message because you are subscribed to the
> > Google
> > > > > > > Groups
> > > > > > > > > "Google Visualization API" group.
> > > > > > > > > To post to this group, send email to
> > > > > > > > > [email protected].
> > > > > > > > > To unsubscribe from this group, send email to
> > > > > > > > > [email protected]<google-visualization-­api%[email protected]>
> > <google-visualization-­­api%[email protected]<api%252bunsubscr­[email protected]>
>
> > > > > <google-visualization-­api%[email protected]<api%252bunsubscri�[email protected]>
> > <api%252bunsubscri­�[email protected]>
>
> > > > > > > <google-visualization-­api%[email protected]<api%252bunsubscri�[email protected]>
> > <api%252bunsubscri­�[email protected]>
> > > > > <api%252bunsubscri�[email protected]>
>
> > > > > > > > > .
> > > > > > > > > For more options, visit this group at
>
> >http://groups.google.com/group/google-visualization-api?hl=en.-Hide
> > > > > > > quoted text -
>
> > > > > > > > - Show quoted text -
>
> > > > > > > --
> > > > > > > You received this message because you are subscribed to the
> > Google
> > > > > Groups
> > > > > > > "Google Visualization API" group.
> > > > > > > To post to this group, send email to
> > > > > > > [email protected].
> > > > > > > To unsubscribe from this group, send email to
> > > > > > > [email protected]<google-visualization-­api%[email protected]>
> > <google-visualization-­­api%[email protected]<api%252bunsubscr­[email protected]>
>
> > > > > <google-visualization-­api%[email protected]<api%252bunsubscri�[email protected]>
> > <api%252bunsubscri­�[email protected]>
>
> > > > > > > .
> > > > > > > For more options, visit this group at
>
> >http://groups.google.com/group/google-visualization-api?hl=en.-Hide
> > > > > quoted text -
>
> > > > > > - Show quoted text -
>
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > Groups
> > > > > "Google Visualization API" group.
> > > > > To post to this group, send email to
> > > > > [email protected].
> > > > > To unsubscribe from this group, send email to
> > > > > [email protected]<google-visualization-­api%[email protected]>
> > <google-visualization-­­api%[email protected]<api%252bunsubscr­[email protected]>
>
> > > > > .
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/google-visualization-api?hl=en.-Hidequ...text
> > > > > -
>
> > > > - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Visualization API" group.
> > To post to this group, send email to
> > [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<google-visualization-­api%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-visualization-api?hl=en.- Hide quoted 
> >text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to