I believe that the problem is that you use a column id 'test', but this is
not a real column id in the spreadsheet.In spreadsheets ,the ids are the
column letters in caps, as they displayed in the spreadsheet itself.
Labels might be taken from the header values, but the ids are the letters.
In addition, you should indeed filter columns by the type they are, so if
the column is string, use: where B='val'. If it is a numeric column, then it
should work as you specified it.

VizGuy

On Wed, Nov 26, 2008 at 3:53 PM, Mathieu <[EMAIL PROTECTED]> wrote:

>
> Now, i use a request in JavaScript to select a column with a condition
> using "where",
> but it doesn't work when i draw the result on my page iGoogle, i get
> "error in query".
>
> The strange thing is : when i do only : query.setQuery('select *'); it
> works
> but when i do : query.setQuery('select * where test <=25'); it doesn't
> work
>
> My spreadsheet already exists : i have  a column "town" with NY,
> Boston, etc. and i have a column "test" with 5,6,25,3,15,7, etc..
>
> Maybe i need to specify that column "test" is a number ?
>
>  <![CDATA[
>  <script type="text/javascript" src="http://www.google.com/jsapi";></
> script>
> <script type="text/javascript">
>      google.load("visualization", "1", {packages:["table"]});
>      google.setOnLoadCallback(initialize);
>
>           function initialize() {
>        // The URL here is the URL of the spreadsheet.
>        // This is where the data is.
>         var query = new google.visualization.Query("http://
> spreadsheets.google.com/ccc?key=.............");
>        query.setQuery('select * where test <=25');
>                query.send(handleQueryResponse);
>      }
>
>       function handleQueryResponse(response) {
>         if (response.isError()) {
>          alert("Error in query")
>        }
>        var ticketsData = response.getDataTable();
>        var table = new google.visualization.Table
> (document.getElementById('patternformat_div'));
>         table.draw(ticketsData, {allowHtml: true, showRowNumber:
> true});
>      }
>     </script>
>  <div id="patternformat_div"></div>
>  ]]>
>
>
> On 20 nov, 22:30, VizGuy <[EMAIL PROTECTED]> wrote:
> > Unfortunately, if you want to use the gadget on top of Google
> Spreadsheets
> > page, you can only use ranges, and there is no way to ignore col B.
> > A few things you can do:
> > 1. You can create another sheet in the same spreadsheet, with formulas
> that
> > only take the relevant cols from the other sheet, and use the chart on
> this
> > data.
> > 2. If you want to display the chart on other places, and not on the
> > spreadsheet (but still read the data from the spreadsheet), you can
> publish
> > it to your iGoogle page (or anyother), and there you can append to the
> data
> > source url, a parameter called tq in which you can specify data
> > manipulations.
> > Seehttp://
> code.google.com/apis/visualization/documentation/querylanguage...
> > more details.
> > In your case it will be like adding to the url: *&tq=select A,C*
> >
> > VizGuy
> >
> > On Thu, Nov 20, 2008 at 10:27 PM, Pragan <[EMAIL PROTECTED]> wrote:
> >
> > > Hi,
> >
> > > How to just display A1 and C1? If I try doing it with a comma or &, it
> > > doesnt work.
> > > I am trying to do this to show something like this
> > >    A               B                   C
> > > 1  pragan       learn             api
> > > 2  Pragan      check           google
> > > 3
> > > So I want to just output
> > > pragan  api
> > > Pragan google
> > > by leaving the value in col B. I guess we cannot define range in this
> > > case. Please let me know.
> >
> > > thanks
> > > On Nov 20, 8:11 am, VizGuy <[EMAIL PROTECTED]> wrote:
> > > > In the data source url, when it points to a Google Stpreadsheets
> page,
> > > you
> > > > can specify the sheet and the range as a apart of the URL:The range
> > > > parameter in the format of A1:B5 can limit the selected range, and
> the
> > > sheet
> > > > can be set by a parameter sheet=<sheetName>
> >
> > > > So the entire url will be something like:
> > >http://spreadsheets.google.com/tq/key=12345&sheet=Sheet1&range=A1:B2
> >
> > > > VizGuy
> >
> > > > On Wed, Nov 19, 2008 at 5:45 PM, Mathieu <[EMAIL PROTECTED]
> >
> > > wrote:
> >
> > > > > Hello,
> >
> > > > > I have a spreadsheet on "Google Documents" with a sheet1, a
> > > > > sheet2, ...
> >
> > > > > 2 things :
> >
> > > > > - I want to select a sheet of my spreadsheet using JavaScript
> > > > > functions, is it possible ?
> > > > > -  After that, i want to select a column of this sheet, and draw
> only
> > > > > this one on my iGoogle page, is it possible ?
> >
> > > > > I did that :
> >
> > >
> ---------------------------------------------------------------------------------------------------
> > > > > function initialize() {
> > > > >        // The URL here is the URL of the spreadsheet.
> > > > >        // This is where the data is.
> > > > >        var query = new google.visualization.Query([EMAIL PROTECTED]);
> > > > >        query.send(draw);
> > > > >      }
> >
> > > > > function draw(response) {
> > > > >        if (response.isError()) {
> > > > >          alert("Error in query")
> > > > >        }
> > > > >        var ticketsData = response.getDataTable();
> > > > >        var table = new google.visualization.Table
> > > > > (document.getElementById('table_div')),
> >
> > > > > // HERE I WANT TO SELECT A SHEET i.e "sheet1"..
> > > > > // AFTER I WANT TO SELECT AND DRAW A COLUMN OF THIS SHEET, i.e
> > > > > "adress"
> >
> > > > >        table.draw(ticketsData, {allowHtml: true, showRowNumber:
> > > > > true});
> >
> > > > >      }
> >
> > >
> ---------------------------------------------------------------------------------------------------
> >
> > > > > Thanks by advance,
> >
> > > > > Mat
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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