Add string/list to datatable without any NewlineSeparator

Hello!

I have my head struck over this issue. I have a string that is always in the same format (18 columns seperated by a comma). The issue im having right now is that I cant easily convert it to a datatable because there is no NewlineSeperator. My Question:

What is the best way of converting this to a datatable?

Things I have thought about. But cant seem to get to work:
Convert string to list
Conver string to array
Add a newlineseperator for each 18th column?

Example string: (36 values, 18 columns, 2 rows)
“DesE ENGE,ActE ENGE,Conf ENGE,DesE ENGM,ActE ENGM,Conf ENGM,DesE WORK,Conf WORK,Customer,Equipment type,langues FLC TWG GRM CKT 1000 tekstplates ,WBS element,PO no.,Requirement del. date SAP,Prev. Requirement del. date SAP,Contact Yes / No,Contract stock,Order date,27-aug,27-aug,X,24-sep,0-jan, ,28-sep, ,ARRIVE,OPC600-05074, ,10.0006058.10.101, ,14-dec,13-nov,contact, ,#N/A”

@Peter_Peter
Lets assume the Data table is already inplace and the cilumnstructure is created

You Vans Split the String by yourstringvar.split(","c) which resturns an Array of Strings

Check If the Count of items IS a multiple of 18 then structure is OK

Taking the First row. arrSPlitsVar.skip(0). Take(18).
ToArray(). The retirned Array you can use for an add data row

Second row is similar with skip(18).Take(18)

For Sure WE can dynamize IT with the use of a for each activity

1 Like