title: Passing a sql table created with alasql from Server (node.js) to Client (ejs)
body: <p>I would be very glad to get some help on the following topic, given I didn't manage to get through it.
  My objective is to gather some data on the server side (so far I'm using alasql to transform my CSV fil into a sql table), and then pass it as a parameter to the client side, to perform other sql operations on Client side (again with alasql).
  So far, I suceeded in</p>
  
  <ul>
  <li>Transforming the CSV file into a sql table thanks to alasql</li>
  <li>Passing a parameter from the Server side to the Client Side</li>
  </ul>
  
  <p>But I did not manage to</p>
  
  <ul>
  <li>Pass the sql table itself from the Server side to the Client side as a parameter</li>
  </ul>
  
  <p>My best result in trying to do so is</p>
  
  <pre><code>`input=[object Object],[object Object],...`
  </code></pre>
  
  <p>instead of the sql table I would expect,which gives an error</p>
  
  <p>My code on the Server side is the following:</p>
  
  <pre><code>var express = require('express');
  var session = require('cookie-session'); // Charge le middleware de sessions
  var bodyParser = require('body-parser'); // Charge le middleware de gestion     des paramètres
  var urlencodedParser = bodyParser.urlencoded({ extended: false });
  var alasql=require('alasql');
  
  var app = express();
  
  var input=0;
  
  alasql('SELECT * FROM CSV("public/data/output.csv",{separator:";"})',[],function(data){
      input=data;
      console.log(1)
  });
  
  /* On utilise les sessions */
  app.use(session({secret: 'TBC'}))
  
  /* S'il n'y a pas de todolist dans la session, on en crée une vide sous forme d'array avant la suite */
  .use(function(req, res, next){
      next();
  })
  
  .use(express.static(__dirname + '/public'))
  
  /* On affiche la todolist et le formulaire */
  .get('/segmentation_clients', function(req, res) { 
      console.log(input);
      var Commercial='U.Morel';
      res.render('segmentation_clients.ejs', {Commercial:'U. Morel',input:input});
  })
  
   .listen(8080);
  </code></pre>
  
  <p>The beginning of the JS code on the Client side (segmentation_clients.ejs):</p>
  
  <pre><code>var Commercial="&lt;%=Commercial%&gt;";
  var input= &lt;%=input%&gt;;
  console.log(input);
  </code></pre>
  
  <p>The output of the code (ok for the #Commercial parameter but not ok for the #input SQL table):
  <a href="https://i.stack.imgur.com/V0uIY.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>I would greatly appreciate your help on this topic</p>
  
  <p>Thanks a lot
  Stéphane</p>