I am converting a dataset to datatable and then converting that datatable to string using the output datatable activity,
Problem is column headers are also getting pasted like this
Is there a way to avoid those column headers ? (Column headers are OUR_REF, PRINCIPAL_NAME etc etc i.e which are in the first line )
Hi @Ishan_Shelke
While save datatable into Excel skip the add header options. It will write only the values in excel
Thanks!!!
Gokul001
(Gokul Balaji)
December 22, 2022, 9:37am
3
HI @Ishan_Shelke
You can keep as it as Data table and use this LINQ expression
Use Assign activity
DtOutput = YourInputDT.AsEnumerable().Skip(1).CopyToDataTable
After that use Output Data Table
Data Table -> DtOutput
Result -> OutString
Paste the data as you need.
Regards
Gokul
Anil_G
(Anil Gorthi)
December 22, 2022, 9:40am
4
Hi @Ishan_Shelke
Please use this in assign
String.Join(",",Dt.AsEnumerable.Select(function(x) string.Join(",",x.itemarray)))
Cheers
ppr
(Peter Preuss)
December 22, 2022, 9:41am
5
as it is generated by the output of this activity you do have following options:
remove first line afterwards from the output datatable result
OR construct the CSV by your self e.g. LINQ
FilteredLines = strOutputDatatableResult.Split({Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries).Skip(1).ToArray
strCSVWithoutHeader = String.Join(Environment.NewLine},FilteredLines )
This is little bit manipulating my output,
Previously :
After applying the above assign :
This is making some of my numbers unrecognizable as you can see, the numbers which are in Inverted commas I want to treat them differently. Doing this, is making my numbers inconsistent
Anil_G
(Anil Gorthi)
December 22, 2022, 10:02am
7
@Ishan_Shelke
May I know what do you mean inconsistent? …you want the values to be surrounded by quotes? If so use like this
String.Join(",",Dt.AsEnumerable.Select(function(x) string.Join(""",""",x.itemarray)))
Hi @Gokul001
I guess this will skip the first row of the data table, not the column headers
system
(system)
Closed
December 25, 2022, 10:15am
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.