<?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[Problem with defining class for CSV dataFile import]]></title><description><![CDATA[<p dir="auto">Hi all - would appreciate your help with something - I'm trying to define a class that will allow me to import CSV data from the local filesystem, that's in the following format:</p>
<p dir="auto"><strong>ExportID, Date, Value<br />
000D6F00010B760C_100333,2014-05-01T14:08:00,213855.4<br />
000D6F0001A31EAF_100333,2014-05-01T14:08:00,348968.6<br />
000D6F00010B75B8_100333,2014-05-01T14:09:00,347326.1<br />
000D6F00010B7540_100333,2014-05-01T14:09:00,480619.3<br />
000D6F00010B73A2_100333,2014-05-01T14:09:00,424276.6</strong></p>
<p dir="auto">The dateTime stamp is in the format yyyy-MM-ddThh:mm:ss</p>
<p dir="auto">There's an example of a CSV import class given in the dataFile module that goes something like this:</p>
<p dir="auto">**extends AbstractCSVDataSource {</p>
<pre><code>DateTimeFormatter dtf = DateTimeFormat.forPattern("MM/dd/yyyy hh:mm");
Map&amp;lt;String, Integer&amp;gt; headerMap = new HashMap&amp;lt;String, Integer&amp;gt;();

@Override

public void importRow(String[] row, int rowNum) {

    if(rowNum == 0) for (int k = 0; k &amp;lt; row.length; ++k) { headerMap.put(row[k], k); }
    
    else this.parsedPoints.add(

        new NumericImportPoint(
        row[headerMap.get(&amp;quot;ID&amp;quot;)],
        Double.parseDouble(row[headerMap.get(&amp;quot;Temperature&amp;quot;)]),
        dtf.parseDateTime(row[headerMap.get(&amp;quot;Date&amp;quot;)] + &amp;quot; &amp;quot; + row[headerMap.get(&amp;quot;Time&amp;quot;)]).getMillis() ) );

}
</code></pre>
<p dir="auto">}**</p>
<p dir="auto">As it stands, I'm getting the following compile error:</p>
<p dir="auto"><strong>error: constructor NumericImportPoint in class NumericImportPoint cannot be applied to given types;<br />
new NumericImportPoint(<br />
^<br />
required: String,double,long,Map&lt;String,String&gt;<br />
found: String,double,long<br />
reason: actual and formal argument lists differ in length</strong></p>
<p dir="auto">So I'm thinking NumericImportPoint is not being mapped correctly. Here's what NumericImportPoint looks like for reference:</p>
<p dir="auto">**package com.infiniteautomation.datafilesource.dataimage;</p>
<p dir="auto">import java.util.Map;</p>
<p dir="auto">import com.infiniteautomation.datafilesource.dataimage.ImportPoint;</p>
<p dir="auto">public class NumericImportPoint extends ImportPoint{</p>
<pre><code>    public final double value;

    public NumericImportPoint(String identifier, double value, long time, Map&amp;lt;String, String&amp;gt; extraParams) {
            super(identifier, time, extraParams);
            this.value = value;
    }

    @Override
    public DataType getDataType() {
            return DataType.NUMERIC;
    }
</code></pre>
<p dir="auto">}**</p>
<p dir="auto">What I'm trying to do is (a) get the original code to a point where it will compile and then (b) modify this code for my CSV file above.</p>
<p dir="auto">A sample of the CSV file that the class within the documentation is designed for would be helpful also!</p>
<p dir="auto">Thanks,<br />
Brendan</p>
]]></description><link>https://forum.mango-os.com/topic/1636/problem-with-defining-class-for-csv-datafile-import</link><generator>RSS for Node</generator><lastBuildDate>Wed, 14 Oct 2026 12:52:13 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/1636.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 04 Aug 2014 14:30:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem with defining class for CSV dataFile import on Mon, 04 Aug 2014 21:32:10 GMT]]></title><description><![CDATA[<p dir="auto">Ah, that is mistaken in the documentation as well. I believe the .class is required.</p>
]]></description><link>https://forum.mango-os.com/post/8964</link><guid isPermaLink="true">https://forum.mango-os.com/post/8964</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Mon, 04 Aug 2014 21:32:10 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with defining class for CSV dataFile import on Mon, 04 Aug 2014 21:30:38 GMT]]></title><description><![CDATA[<p dir="auto">Why did you remove the .class extension? I believe that is the cause of it not being in the list.</p>
]]></description><link>https://forum.mango-os.com/post/8963</link><guid isPermaLink="true">https://forum.mango-os.com/post/8963</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Mon, 04 Aug 2014 21:30:38 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with defining class for CSV dataFile import on Mon, 04 Aug 2014 21:29:19 GMT]]></title><description><![CDATA[<p dir="auto">Hi Phil, Thanks for the help - the compile worked with the following code in case it's of use to anyone else:</p>
<p dir="auto">import java.util.HashMap;<br />
import java.util.Map;<br />
import org.joda.time.format.DateTimeFormat;<br />
import org.joda.time.format.DateTimeFormatter;<br />
import com.infiniteautomation.datafilesource.contexts.AbstractCSVDataSource;<br />
import com.infiniteautomation.datafilesource.dataimage.NumericImportPoint;</p>
<p dir="auto">public class epiCSV</p>
<p dir="auto">extends AbstractCSVDataSource {</p>
<p dir="auto">DateTimeFormatter dtf = DateTimeFormat.forPattern("yyyy-MM-ddThh:mm:ss");<br />
Map&lt;String, Integer&gt; headerMap = new HashMap&lt;String, Integer&gt;();<br />
@Override</p>
<p dir="auto">public void importRow(String[] row, int rowNum) {</p>
<p dir="auto">if(rowNum == 0) for (int k = 0; k &lt; row.length; ++k) { headerMap.put(row[k], k); }</p>
<p dir="auto">else this.parsedPoints.add(</p>
<p dir="auto">new NumericImportPoint(<br />
row[headerMap.get("ExportID")],<br />
Double.parseDouble(row[headerMap.get("Value")]),<br />
dtf.parseDateTime(row[headerMap.get("Date")]).getMillis(),<br />
new HashMap&lt;String, String&gt;() ) );</p>
<p dir="auto">}<br />
}</p>
<p dir="auto">I copied the class into /web/modules/dataFile/web/templates/CSV/ and removed the .class extension, removed the placeholder file, saved the datasource, restarted etc. but I can't seem to get the 'template' to show up in the drop down list on the UI when adding a new data source (screenshot attached). Not sure if I'm missing another step?</p>
<p dir="auto">Thanks,<br />
Brendan</p>
<p dir="auto">Attachment: <a href="http://archive.infiniteautomation.com/forum/posts/downloadAttach/316.page" rel="nofollow ugc">download link</a></p>
]]></description><link>https://forum.mango-os.com/post/8962</link><guid isPermaLink="true">https://forum.mango-os.com/post/8962</guid><dc:creator><![CDATA[episensor]]></dc:creator><pubDate>Mon, 04 Aug 2014 21:29:19 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with defining class for CSV dataFile import on Mon, 04 Aug 2014 20:47:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/episensor" aria-label="Profile: episensor">@<bdi>episensor</bdi></a> said:</p>
<blockquote>
<p dir="auto">Hi Phil,</p>
<p dir="auto">That's great - thanks very much. I think I'm nearly there, but I'm not quite sure how to construct this - what I have is the following:</p>
<p dir="auto">extends AbstractCSVDataSource {</p>
<p dir="auto">DateTimeFormatter dtf = DateTimeFormat.forPattern("yyyy-MM-ddThh:mm:ss");<br />
Map&lt;String, Integer&gt; headerMap = new HashMap&lt;String, Integer&gt;();<br />
// new HashMap argument<br />
@Override</p>
<p dir="auto">public void importRow(String[] row, int rowNum) {</p>
<pre><code>   if(rowNum == 0) for (int k = 0; k &lt; row.length; ++k) { headerMap.put(row[k], k); }
   
   else this.parsedPoints.add(
                          
       new NumericImportPoint(
       row[headerMap.get("ExportID")],
       dtf.parseDateTime(row[headerMap.get("Date")]),
       Double.parseDouble(row[headerMap.get("Value")]),
       new HashMap&lt;String, String&gt;() ) );
</code></pre>
<p dir="auto">}<br />
}</p>
<p dir="auto">/* to parse the following CSV file:</p>
<p dir="auto">ExportID, Date, Value<br />
000D6F00010B760C_100333,2014-05-01T14:08:00,213855.4<br />
000D6F0001A31EAF_100333,2014-05-01T14:08:00,348968.6<br />
000D6F00010B75B8_100333,2014-05-01T14:09:00,347326.1<br />
000D6F00010B7540_100333,2014-05-01T14:09:00,480619.3<br />
000D6F00010B73A2_100333,2014-05-01T14:09:00,424276.6</p>
<p dir="auto">*/</p>
<p dir="auto">If you could nudge me in the right direction that would be greatly appreciated!</p>
<p dir="auto">Best Regards,<br />
Brendan</p>
</blockquote>
<p dir="auto">I made the change to the constructor in the quote block that I think is missing.</p>
]]></description><link>https://forum.mango-os.com/post/8960</link><guid isPermaLink="true">https://forum.mango-os.com/post/8960</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Mon, 04 Aug 2014 20:47:45 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with defining class for CSV dataFile import on Mon, 04 Aug 2014 20:35:11 GMT]]></title><description><![CDATA[<p dir="auto">Hi Phil,</p>
<p dir="auto">That's great - thanks very much. I think I'm nearly there, but I'm not quite sure how to construct this - what I have is the following:</p>
<p dir="auto">extends AbstractCSVDataSource {</p>
<pre><code>DateTimeFormatter dtf = DateTimeFormat.forPattern("yyyy-MM-ddThh:mm:ss");
Map&lt;String, Integer&gt; headerMap = new HashMap&lt;String, Integer&gt;();
// new HashMap argument
@Override

public void importRow(String[] row, int rowNum) {

    if(rowNum == 0) for (int k = 0; k &lt; row.length; ++k) { headerMap.put(row[k], k); }
    
    else this.parsedPoints.add(
                           
        new NumericImportPoint(
        row[headerMap.get("ExportID")],
        dtf.parseDateTime(row[headerMap.get("Date")]),
        Double.parseDouble(row[headerMap.get("Value")]) ) );
    
}
</code></pre>
<p dir="auto">}</p>
<p dir="auto">/* to parse the following CSV file:</p>
<p dir="auto">ExportID, Date, Value<br />
000D6F00010B760C_100333,2014-05-01T14:08:00,213855.4<br />
000D6F0001A31EAF_100333,2014-05-01T14:08:00,348968.6<br />
000D6F00010B75B8_100333,2014-05-01T14:09:00,347326.1<br />
000D6F00010B7540_100333,2014-05-01T14:09:00,480619.3<br />
000D6F00010B73A2_100333,2014-05-01T14:09:00,424276.6</p>
<p dir="auto">*/</p>
<p dir="auto">If you could nudge me in the right direction that would be greatly appreciated!</p>
<p dir="auto">Best Regards,<br />
Brendan</p>
]]></description><link>https://forum.mango-os.com/post/8959</link><guid isPermaLink="true">https://forum.mango-os.com/post/8959</guid><dc:creator><![CDATA[episensor]]></dc:creator><pubDate>Mon, 04 Aug 2014 20:35:11 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with defining class for CSV dataFile import on Mon, 04 Aug 2014 19:54:47 GMT]]></title><description><![CDATA[<p dir="auto">Here is the CSV that resulted in that example:</p>
<p dir="auto">"Nr.","Date","Time","Meas.Unit","Value","Unit","Offset","Unit","Alpha","Unit","Temperature","Unit","ID"<br />
0001,"12/19/2013","13:07","Extract",-0.0,"°Plato",,,,,20.1,"°C","FV6-01"<br />
0002,"12/19/2013","13:08","Extract",-0.1,"°Plato",,,,,20.5,"°C","FV6-02"<br />
0003,"12/19/2013","13:36","Extract",-0.0,"°Plato",,,,,20.7,"°C","FV7-01"<br />
0004,"12/19/2013","13:38","Extract",-0.0,"°Plato",,,,,20.8,"°C","FV7-02"</p>
]]></description><link>https://forum.mango-os.com/post/8957</link><guid isPermaLink="true">https://forum.mango-os.com/post/8957</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Mon, 04 Aug 2014 19:54:47 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with defining class for CSV dataFile import on Mon, 04 Aug 2014 19:46:24 GMT]]></title><description><![CDATA[<p dir="auto">I need to update that documentation! The fourth argument is a Map of a few traits you can specify for created points, if you use the data source to create the points.</p>
<p dir="auto">To resolve, add a fourth argument to the constructor:</p>
<p dir="auto">new HashMap&lt;String, String&gt;()</p>
<p dir="auto">I will update the documents...</p>
]]></description><link>https://forum.mango-os.com/post/8956</link><guid isPermaLink="true">https://forum.mango-os.com/post/8956</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Mon, 04 Aug 2014 19:46:24 GMT</pubDate></item></channel></rss>