0

I am new to google map api as well as fusion table. I want to make a dynamic query using fusion table. for that i am using the following piece of code:

var layer3
var yr = 2015;
layer3 = new google.maps.FusionTablesLayer({
          query: {

            select: 'Name_Farmer',
            from: '19ZEAwp0-rJNI1alzTRzgjJBqT1SKR3Ij_N_LfAxR',
             where: 'Year > 2015'
// where: 'Year > yr'
          }
        });

    layer3.setMap(map);

If the where clause 'year>2015' works, then why is 'year>yr' not working when I have assigned a global variable for yr=2015?

1

Here you are assigning a string object to a dictionary element, where. Everything within the quotation marks are considered as literal, i.e., if yr is within the quotes, it gets assigned literally, as in your Year >2015 case. Therefore you need to format your string properly before assigning. I think, where: 'Year > ' + yr should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.