<?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[Data Source DataFile]]></title><description><![CDATA[<p dir="auto">Hi Phillip,</p>
<p dir="auto">In the data source "DataFile", you can define the character of the columns in a csv file, in the ejmplo use the separation with "," but in the file that will use uses the character ";"</p>
]]></description><link>https://forum.mango-os.com/topic/2801/data-source-datafile</link><generator>RSS for Node</generator><lastBuildDate>Fri, 09 Oct 2026 16:42:56 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/2801.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 06 Jun 2017 16:01:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Data Source DataFile on Wed, 14 Jun 2017 21:35:42 GMT]]></title><description><![CDATA[<p dir="auto">Something like....</p>
<pre><code>import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;

import com.infiniteautomation.datafilesource.contexts.AbstractCSVDataSource;
import com.infiniteautomation.datafilesource.dataimage.NumericImportPoint;

public class JergForumCsvQuestion extends AbstractCSVDataSource {
	private boolean headersConsumed = false;
	private SimpleDateFormat dtf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
	
	@Override
	public void importRow(String[] data, int rowNum) {
		if(data.length == 0)
			return;
		Map&lt;String, String&gt; extraParams = new HashMap&lt;&gt;();
		String[] rowData = data[0].split(";");
		
		if(rowData.length &lt; 7) //avoid index out of bounds
			return;
			
		try {
			//subtract the timezone, or you could put it into the date formatter (or add the timezone, 
			//it's not always easy to know if they're saying those times are in UTC-5 or those times are UTC)
			long time = dtf.parse(rowData[3]).getTime() - 5*60*60*1000; 
			this.parsedPoints.add(new NumericImportPoint("PV Solar kWh", Double.valueOf(rowData[5]), time, extraParams));
			this.parsedPoints.add(new NumericImportPoint("PV Solar W/m^2", Double.valueOf(rowData[6]), time, extraParams));
		} catch(Exception e) { System.out.println("Exception: " + e.getMessage()); }
	}
}
</code></pre>
]]></description><link>https://forum.mango-os.com/post/14673</link><guid isPermaLink="true">https://forum.mango-os.com/post/14673</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Wed, 14 Jun 2017 21:35:42 GMT</pubDate></item><item><title><![CDATA[Reply to Data Source DataFile on Wed, 14 Jun 2017 15:15:47 GMT]]></title><description><![CDATA[<p dir="auto">Hi Jerg,</p>
<p dir="auto">Did you attempt the solution I provided?</p>
]]></description><link>https://forum.mango-os.com/post/14656</link><guid isPermaLink="true">https://forum.mango-os.com/post/14656</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Wed, 14 Jun 2017 15:15:47 GMT</pubDate></item><item><title><![CDATA[Reply to Data Source DataFile on Tue, 13 Jun 2017 15:09:56 GMT]]></title><description><![CDATA[<p dir="auto">Hi Phillips.</p>
<p dir="auto">Attachment fragment of our CSV file, as you can see the same uses as ";" character. In the example in Mango use ","</p>
<p dir="auto">PVSolarPlant;InsCap(kW);From yyyy-MM-dd HH:mm;To yyyy-MM-dd HH:mm;UTC offset(HHmm);Forecast(kWh);Rad(W/m2)<br />
PV Solar;4920;2017-05-31 15:00;2017-05-31 16:00;UTC-0500;1547;284<br />
PV Solar;4920;2017-05-31 16:00;2017-05-31 17:00;UTC-0500;866;151<br />
PV Solar;4920;2017-05-31 17:00;2017-05-31 18:00;UTC-0500;413;66<br />
PV Solar;4920;2017-05-31 18:00;2017-05-31 19:00;UTC-0500;103;19<br />
PV Solar;4920;2017-05-31 19:00;2017-05-31 20:00;UTC-0500;0;0<br />
PV Solar;4920;2017-05-31 20:00;2017-05-31 21:00;UTC-0500;0;0<br />
PV Solar;4920;2017-05-31 21:00;2017-05-31 22:00;UTC-0500;0;0<br />
PV Solar;4920;2017-05-31 22:00;2017-05-31 23:00;UTC-0500;0;0<br />
PV Solar;4920;2017-05-31 23:00;2017-06-01 00:00;UTC-0500;0;0<br />
PV Solar;4920;2017-06-01 00:00;2017-06-01 01:00;UTC-0500;0;0<br />
PV Solar;4920;2017-06-01 01:00;2017-06-01 02:00;UTC-0500;0;0<br />
PV Solar;4920;2017-06-01 02:00;2017-06-01 03:00;UTC-0500;0;0<br />
PV Solar;4920;2017-06-01 03:00;2017-06-01 04:00;UTC-0500;0;0<br />
PV Solar;4920;2017-06-01 04:00;2017-06-01 05:00;UTC-0500;0;0<br />
PV Solar;4920;2017-06-01 05:00;2017-06-01 06:00;UTC-0500;0;0</p>
]]></description><link>https://forum.mango-os.com/post/14645</link><guid isPermaLink="true">https://forum.mango-os.com/post/14645</guid><dc:creator><![CDATA[Jerg]]></dc:creator><pubDate>Tue, 13 Jun 2017 15:09:56 GMT</pubDate></item><item><title><![CDATA[Reply to Data Source DataFile on Tue, 06 Jun 2017 16:11:41 GMT]]></title><description><![CDATA[<p dir="auto">Hi Jerg,</p>
<p dir="auto">I am not sure what 'ejmplo' is.</p>
<p dir="auto">You cannot configure the CSV type to parse on another character, but you can do that easily enough in the importRow method as String[] row will have your string at index zero. So...</p>
<pre><code>public void importRow(String[] row, int rowNum) {
  if(row.length == 0)
    return;
  String[] rowData = row[0].split(";");
  /* use rowData instead
  ... this.parsedPoints.add(new AlphanumericImportPoint( rowData[0], ... ));
  */
}</code></pre>
]]></description><link>https://forum.mango-os.com/post/14618</link><guid isPermaLink="true">https://forum.mango-os.com/post/14618</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Tue, 06 Jun 2017 16:11:41 GMT</pubDate></item></channel></rss>