# How to read a string of Tagnames from a csv file

**URL:** <https://discourse.nodered.org/t/how-to-read-a-string-of-tagnames-from-a-csv-file/25925>\
**Category:** General\
**Created:** [2 May 2020 14:18 UTC](https://discourse.nodered.org/t/how-to-read-a-string-of-tagnames-from-a-csv-file/25925 "2020-05-02T14:18:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Munier](https://avatars.discourse-cdn.com/v4/letter/m/e99b99/32.png) [@Munier](https://discourse.nodered.org/u/Munier)\
**Post date:** [2 May 2020 14:18 UTC](https://discourse.nodered.org/t/how-to-read-a-string-of-tagnames-from-a-csv-file/25925/1 "2020-05-02T14:18:32Z")

</div>

Hello all  
Can you please help me on how I can read the string of the id as in the table below?

I want to find a way to make the function node read the string for the id for example

E01 to read as E01\_UA,

E02 to read as E02\_UA,

E03 to read as E03\_UA,

E04 to read as E04\_UA,

E05 to read as E07\_UA, and so on.

The line of code in bold from the function node is where I think I need to modify:

\

```auto
msg.payload = msg.payload.replace(/(-?\d+\.\d+E[-+]\d+)/g,
function(v) { return Number(v) });

payload=msg.payload;
var n=payload.search("E");
msg.n=n;
var sub=payload.slice(n);
//msg.sub=sub.replace(/(\r\n|\n|\r)/gm, "M");
sub=sub.split("\n");
msg.payload=[];

var l=(sub.length/1);

for (var i=0;i<l-1;i++)
{
var out={};
var all={};
var a=sub[i].split(",")
var b=sub[i].split(",")
out["rv"]=a[1];
out["d"]=a[2];
out["sd"]=a[3];
out["V"]=a[4];
out["W"]=a[5];
out["F"]=a[6];
out["P"]=a[7];
 **out["id"]="E0"+(i+1);**
out["timestamp"]=Date.now();
msg.payload.push(out);
flow.set("all",msg.payload);

```

\

Here is the screen for the table node I am using

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/c/9c0c40348d5ffab6c7aa93f6c993d62a92e229d1.png)

This is how the data from the file look like before it is update in the table dashboard

E01\_UA, 0.2092123763E+002, 0.0000000000E+000, 0.1143758876E+001, 0.0000000000E+000, 0.1880263256E+002, 0.2303984271E+002, 0.0000000000E+000  
E02\_UA, 0.8806830641E+002, 0.0000000000E+000, 0.3886178257E+001, 0.0000000000E+000, 0.8416309878E+002, 0.9197351404E+002, 0.0000000000E+000  
E03\_UA, 0.1264110741E+003, 0.0000000000E+000, 0.2370249419E+002, 0.0000000000E+000, 0.1167665724E+003, 0.1360555758E+003, 0.0000000000E+000  
E04\_UA, 0.2338329058E+003, 0.0000000000E+000, 0.1804836659E+003, 0.0000000000E+000, 0.2072194224E+003, 0.2604463891E+003, 0.0000000000E+000  
E07\_UA, 0.2236577017E+002, 0.0000000000E+000, 0.2438269836E+002, 0.0000000000E+000, 0.1258386038E+002, 0.3214767995E+002, 0.0000000000E+000  
E08\_UA, 0.1505696738E+002, 0.0000000000E+000, 0.1429688819E+001, 0.0000000000E+000, 0.1268830300E+002, 0.1742563177E+002, 0.0000000000E+000  
E09\_UA, 0.3175935211E+002, 0.0000000000E+000, 0.8312104765E+001, 0.0000000000E+000, 0.2604800870E+002, 0.3747069552E+002, 0.0000000000E+000  
E10\_UA, 0.1283908179E+002, 0.0000000000E+000, 0.1715776294E+001, 0.0000000000E+000, 0.1024422674E+002, 0.1543393683E+002, 0.0000000000E+000  
E11\_UA, 0.2488148155E+003, 0.0000000000E+000, 0.7234985292E+003, 0.0000000000E+000, 0.1955302294E+003, 0.3020994016E+003, 0.0000000000E+000  
E12\_UA, 0.7311456750E+002, 0.0000000000E+000, 0.1492298679E+002, 0.0000000000E+000, 0.6546193871E+002, 0.8076719630E+002, 0.0000000000E+000  
E13\_UA, 0.1185333744E+003, 0.0000000000E+000, 0.1852562362E+003, 0.0000000000E+000, 0.9157031373E+002, 0.1454964350E+003, 0.0000000000E+000  
E14\_UA, -0.1029447393E+002, 0.0000000000E+000, 0.7710681912E+001, 0.0000000000E+000, -0.1579531584E+002, -0.4793632020E+001, 0.0000000000E+000  
E15\_UA, 0.2675784682E+003, 0.0000000000E+000, 0.3086805796E+003, 0.0000000000E+000, 0.2327738059E+003, 0.3023831305E+003, 0.0000000000E+000  
E35\_UA, 0.1758112170E+003, 0.0000000000E+000, 0.6057200934E+002, 0.0000000000E+000, 0.1603935464E+003, 0.1912288875E+003, 0.0000000000E+000  
E36\_UA, 0.2615723276E+002, 0.0000000000E+000, 0.1366443169E+004, 0.0000000000E+000, -0.4707100064E+002, 0.9938546617E+002, 0.0000000000E+000  
E37\_UA, 0.8135408388E+002, 0.0000000000E+000, 0.3468968698E+002, 0.0000000000E+000, 0.6968644549E+002, 0.9302172227E+002, 0.0000000000E+000  
E38A\_UA, -0.6093073380E+002, 0.0000000000E+000, 0.1324842048E+003, 0.0000000000E+000, -0.8373230750E+002, -0.3812916010E+002, 0.0000000000E+000  
E38B\_UA, 0.1015839676E+003, 0.0000000000E+000, 0.7474829542E+002, 0.0000000000E+000, 0.8445688405E+002, 0.1187110512E+003, 0.0000000000E+000  
E39\_UA, 0.2334203450E+002, 0.0000000000E+000, 0.1570619948E+002, 0.0000000000E+000, 0.1549115476E+002, 0.3119291424E+002, 0.0000000000E+000  
E40\_UA, 0.1512040735E+003, 0.0000000000E+000, 0.4130469851E+003, 0.0000000000E+000, 0.1109432644E+003, 0.1914648826E+003, 0.0000000000E+000  
E41\_UA, 0.2162529837E+002, 0.0000000000E+000, 0.4425810755E+002, 0.0000000000E+000, 0.8446397539E+001, 0.3480419921E+002, 0.0000000000E+000

---

<div class="post-metadata">

**Author:** ![Munier](https://avatars.discourse-cdn.com/v4/letter/m/e99b99/32.png) [@Munier](https://discourse.nodered.org/u/Munier)\
**Post date:** [2 May 2020 17:24 UTC](https://discourse.nodered.org/t/how-to-read-a-string-of-tagnames-from-a-csv-file/25925/2 "2020-05-02T17:24:32Z")

</div>

I have manage to get the tag name with

`out["id"]=a[0];`

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/6/0688150df53ccf0802704a1710310ae29fa46241.png)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [16 May 2020 17:24 UTC](https://discourse.nodered.org/t/how-to-read-a-string-of-tagnames-from-a-csv-file/25925/3 "2020-05-16T17:24:32Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
