Assuming I have the contents of a CSV file I want to transform this to a format to easily do an htmlDump but I can’t seem to figure out in the script to get it from System.Collections.Generic.List1[System.Collections.Generic.List1[System.String]] to the correct format:
{{ csvData | parseCsv | to => d}}
{{d}}
That outputs the generic list type info above so that’s what we have. csvData is just a read in string from a file.
Thanks for the pointers here. I am using the new pipe going forward that was just an old script I was testing on.
The problem with this is the csv’s are dynamic and the example lacks all the preprocessing to get the header row/etc. The example I reviewed prior but it is hard coded and I just couldn’t seem to figure out how to get it all to work. In my example csvData is the csv file content with header row.
I guess there is no easy way. Ended up just building the table manually for now which was a little more work but straightforward. I was just hoping to easily use htmlDump since that utility is so nice and can easily just be styled.
It should be easier to implement convertCsv in a C# Script Method that takes List<List<string>> and convert it to a list of named Key/Value Pairs in a List<Dictionary<string,string>>.
Thank you, I really enjoy the script support but sometimes struggle trying to figure out the best way to do something. I was going to look at creating a custom method but this is all done on a razor view in umbraco and didn’t want to overcomplicate it. Quite frankly, the scripting support is so awesome I rarely need to.