Demo entry 5862494

mypythoncode

   

Submitted by anonymous on Aug 07, 2016 at 14:23
Language: JavaScript. Code size: 1.2 kB.

     // creating a table is in principle similar to the process of inserting data
     // first the table is defined using plain JSON format
     // the string is pushed element by element into an array
     function createTable() {
        console.log("createTable");
        var path = '/fusiontables/v2/tables';

        var tableDefinition = [];
        tableDefinition.push("{");
        tableDefinition.push("'name': 'Box Office Mojo',");
        tableDefinition.push("'columns': [");
        tableDefinition.push("{ 'name': 'Released', 'type': 'NUMBER' },");
        tableDefinition.push("{ 'name': 'Film Name', 'type': 'STRING' },");
        tableDefinition.push("{ 'name': 'Total Box Office', 'type': 'NUMBER' }");
        tableDefinition.push("],")
        tableDefinition.push("isExportable: true");
        tableDefinition.push("}");
        var body = tableDefinition.join(''),

        // the array is joined and send of to Fusion Tables API
        // while the request is handled within
        runClientRequest({
          path: path,
          body: body,
          method: 'POST'
        }, callback('create-table-output'));
      }

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).