Loading ...
Sorry, an error occurred while loading the content.

exclude columns from result

Expand Messages
  • hleogr
    Hi, In a project I need to send back the dataset result from a TAFFY DB querie. The dataset must be cleaned from the additional columns which TAFFY is adding
    Message 1 of 1 , Aug 10, 2012
    View Source
    • 0 Attachment
      Hi,

      In a project I need to send back the dataset result from a TAFFY DB querie. The dataset must be "cleaned" from the additional columns which TAFFY is adding to the dataset ("___id" and "___s"). Is there a function already implemented in TAFFY to do this? I could not found a way and I had to write a extensions. Maybe this could be added to the next version something like

      db.exclude("column1","column4");

      This should return the dataset without the columns named "column1" and "column4". At the moment I have build an extension to clean the data that looks like this:

      API.extend("getClean", function () {
      // ****************************************
      // *
      // * Takes: all columns excluding ___id and ___s
      // * Returns: array of values
      // ****************************************
      var ex = {
      "___id":true,
      "___s":true
      };
      var ra = [];
      var args = arguments;
      run.call(this);
      each(this.context().results,function (r) {
      var row = {};
      for(var i in r){
      if(!ex[i])row[i] = r[i];
      }
      ra.push(row);
      });
      return ra;
      });


      Cheers,
      hleogr
    Your message has been successfully submitted and would be delivered to recipients shortly.