• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    If want to get arry to out as csv file ?How to do ?

    User help
    1
    3
    1.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      edmond
      last edited by

      Now I have received some sensor .and get the point value.

      If I want to as a array to get csv file

      for example: this is download the csv file when I click to "comma separated value(CSV)".
      Date Time XX1 XX2 XX3 XX4 XX5 XX6 XX7 XX8 XX10 XX11 XX12
      1/10/2014 19?13?20 0.411 3.554 3.111 1.021 433.33 777.91 22 29 23 65 5.0

      and I use meta add a script

      var arr=[p41.value,p42.value,p43.value,p40.value,p39.value,p1.value];
      var str="";
      for ( var i=0; i<arr.length; i++)
      {str+=arr*.toString();
      str+=","
      }
      if (str.length >0)
      {return str.substr(0, str.length - 1);
      }
      return str;

      Now I can get the data to display as attachment

      But I canot find get the csv the button.How to do get the csv file ?

      Thank in advance!!!

      Attachment: download link

      1 Reply Last reply Reply Quote 0
      • E
        edmond
        last edited by

        var tableToExcel = function() {
        var uri = 'data:application/vnd.ms-excel;base64,',
        template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>',
        base64 = function(s) {
        return window.btoa(unescape(encodeURIComponent(s)))
        },
        format = function(s, c) {
        return s.replace(/{(\w+)}/g,
        function(m, p) {
        return c[p];
        })
        };

        		var tableHTML="<tbody>";
        			tableHTML+="<tr>";
        			tableHTML+="<td>";
        			tableHTML+='p41.value';
        			tableHTML+="</td>";
        			tableHTML+="<td>";
        			tableHTML+='p42.value';
        			tableHTML+="</td>";
        			tableHTML+="<td>";
        			tableHTML+='p43.value';
        			tableHTML+="</td>";
        			tableHTML+="<td>";
        			tableHTML+='p40.value';
        			tableHTML+="</td>";
        			tableHTML+="<td>";
        			tableHTML+='p39.value';
        			tableHTML+="</td>";
        			tableHTML+="<td>";
        			tableHTML+='p1.value';
        			tableHTML+="</td>";
        			tableHTML+="</tr>";
        			tableHTML+="</tbody>";
        
        		return function(html, name) {
        			var ctx = {
        				worksheet: name || 'Worksheet',
        				table: html
        			};
        			window.location.href = uri + base64(format(template, ctx))
        		}(tableHTML, "???");
        	};
        

        tableToExcel();

        1, for the Script, whether the document can be output directly to excel in Script code inside.
        2, Script code is based on ECMAScript, which I have used in the script code embedded object browser window, such as window.location.href, then the error: "window" not defined, would like to ask why did not add to the browser embedded support objects
        3, if Script excel file can not be output through the code, so if there are other ways to generate excel file by writing code
        Is there a software system which can be called directly related to the function or function object and then output file?

        Thanks

        Attachment: download link

        1 Reply Last reply Reply Quote 0
        • First post
          Last post