EvaldoMaciel

Dataset Base Integração

Apr 13th, 2021
1,182
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function createDataset(fields, constraints, sortFields) {
  2.     var dataset = DatasetBuilder.newDataset();
  3.  
  4.     var objeto = new Array({
  5.         "A": "Faca",
  6.         "B": "Garfo",
  7.         "C": "Colher",
  8.     }, {
  9.         "A": "Alicate",
  10.         "B": "Fenda",
  11.         "C": "Philips",
  12.     });
  13.  
  14.     var colunas = new Array();
  15.  
  16.     for (var key in objeto[0]) {
  17.         dataset.addColumn(key);
  18.         colunas.push(key)
  19.     }
  20.  
  21.     for (var index = 0; index < objeto.length; index++) {
  22.         var valores = new Array();
  23.         for (var idx = 0; idx < colunas.length; idx++) {
  24.             valores.push(objeto[index][colunas[idx]]);
  25.         }
  26.         dataset.addRow(valores);
  27.     }
  28.  
  29.     return dataset;
  30. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×