<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[If want to get arry to out as csv file ?How to do ?]]></title><description><![CDATA[<p dir="auto">Now I have received some sensor .and get the point value.</p>
<p dir="auto">If I want to as a array to get csv file</p>
<p dir="auto">for example: this is download the csv file when I click to "comma separated value(CSV)".<br />
Date             Time                  XX1         XX2     XX3      XX4     XX5          XX6        XX7  XX8   XX10  XX11    XX12<br />
1/10/2014     19?13?20         0.411     3.554   3.111    1.021  433.33     777.91    22     29      23     65          5.0</p>
<p dir="auto">and I use meta  add a script</p>
<p dir="auto">var arr=[p41.value,p42.value,p43.value,p40.value,p39.value,p1.value];<br />
var str="";<br />
for ( var i=0; i&lt;arr.length; i++)<br />
{str+=arr*.toString();<br />
str+=","<br />
}<br />
if (str.length &gt;0)<br />
{return str.substr(0, str.length - 1);<br />
}<br />
return str;</p>
<p dir="auto">Now I can get the data to display as attachment</p>
<p dir="auto">But I canot find get the csv the button.How to do get the csv file ?</p>
<p dir="auto">Thank in advance!!!</p>
<p dir="auto">Attachment: <a href="http://archive.infiniteautomation.com/forum/posts/downloadAttach/413.page" rel="nofollow ugc">download link</a></p>
]]></description><link>https://forum.mango-os.com/topic/1733/if-want-to-get-arry-to-out-as-csv-file-how-to-do</link><generator>RSS for Node</generator><lastBuildDate>Wed, 13 May 2026 15:52:54 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/1733.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 15 Oct 2014 12:00:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to If want to get arry to out as csv file ?How to do ? on Wed, 15 Oct 2014 20:08:12 GMT]]></title><description><![CDATA[<p dir="auto">var tableToExcel = function() {<br />
var uri = 'data:application/vnd.ms-excel;base64,',<br />
template = '&lt;html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="<a href="http://www.w3.org/TR/REC-html40" rel="nofollow ugc">http://www.w3.org/TR/REC-html40</a>"&gt;&lt;head&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;&lt;x:ExcelWorkbook&gt;&lt;x:ExcelWorksheets&gt;&lt;x:ExcelWorksheet&gt;&lt;x:Name&gt;{worksheet}&lt;/x:Name&gt;&lt;x:WorksheetOptions&gt;&lt;x:DisplayGridlines/&gt;&lt;/x:WorksheetOptions&gt;&lt;/x:ExcelWorksheet&gt;&lt;/x:ExcelWorksheets&gt;&lt;/x:ExcelWorkbook&gt;&lt;/xml&gt;&lt;![endif]--&gt;&lt;/head&gt;&lt;body&gt;&lt;table&gt;{table}&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;',<br />
base64 = function(s) {<br />
return window.btoa(unescape(encodeURIComponent(s)))<br />
},<br />
format = function(s, c) {<br />
return s.replace(/{(\w+)}/g,<br />
function(m, p) {<br />
return c[p];<br />
})<br />
};</p>
<pre><code>		var tableHTML="&lt;tbody&gt;";
			tableHTML+="&lt;tr&gt;";
			tableHTML+="&lt;td&gt;";
			tableHTML+='p41.value';
			tableHTML+="&lt;/td&gt;";
			tableHTML+="&lt;td&gt;";
			tableHTML+='p42.value';
			tableHTML+="&lt;/td&gt;";
			tableHTML+="&lt;td&gt;";
			tableHTML+='p43.value';
			tableHTML+="&lt;/td&gt;";
			tableHTML+="&lt;td&gt;";
			tableHTML+='p40.value';
			tableHTML+="&lt;/td&gt;";
			tableHTML+="&lt;td&gt;";
			tableHTML+='p39.value';
			tableHTML+="&lt;/td&gt;";
			tableHTML+="&lt;td&gt;";
			tableHTML+='p1.value';
			tableHTML+="&lt;/td&gt;";
			tableHTML+="&lt;/tr&gt;";
			tableHTML+="&lt;/tbody&gt;";

		return function(html, name) {
			var ctx = {
				worksheet: name || 'Worksheet',
				table: html
			};
			window.location.href = uri + base64(format(template, ctx))
		}(tableHTML, "???");
	};
</code></pre>
<p dir="auto">tableToExcel();</p>
<p dir="auto">1, for the Script, whether the document can be output directly to excel in Script code inside.<br />
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<br />
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<br />
Is there a software system which can be called directly related to the function or function object and then output file?</p>
<p dir="auto">Thanks</p>
<p dir="auto">Attachment: <a href="http://archive.infiniteautomation.com/forum/posts/downloadAttach/414.page" rel="nofollow ugc">download link</a></p>
]]></description><link>https://forum.mango-os.com/post/9392</link><guid isPermaLink="true">https://forum.mango-os.com/post/9392</guid><dc:creator><![CDATA[edmond]]></dc:creator><pubDate>Wed, 15 Oct 2014 20:08:12 GMT</pubDate></item></channel></rss>