Mark,
Thanks, I am using the prerelease and split operator already. After a nights sleep I tried to take another approach and there is clearly something I do not understand.
Here is what I am doing,
- I hope others can use successfully, for processing CSV files,
- but only when I resolve a bug.
- Oddly I do find various macros but not widgets in TiddlyWiki that supposed to parse csv. None of which seems documented at tiddlywiki.com, only the export process.
I added a tag "<eol>" for end of line to each row in the csv
\define each-row(row)
$row$<br>
\end
<$list filter="[{StaffList.csv}split[<eol>]]" variable=input-row>
<$macrocall $name=each-row row=<<input-row>>/>
</$list>
and I get a list of each row.
Then inside the each-row macro above I am adding the following for each field, where the nth[] is the position in each row.
<$set name=fieldname value={{{ [[$row$]split[,]nth[1]] }}} >
The full detail for each row is
<$set name=person-tiddler value={{{ [[$row$]split[,]nth[1]] }}} >
<$set name=first-name value={{{ [[$row$]split[,]nth[2]] }}} >
<$set name=surname value={{{ [[$row$]split[,]nth[3]] }}} >
<$set name=person-role value={{{ [[$row$]split[,]nth[4]] }}} >
<$set name=email-address value={{{ [[$row$]split[,]nth[5]] }}} >
<$set name=import-region value={{{ [[$row$]split[,]nth[6]] }}} >
Person=<<person-tiddler>>
first-name=<<first-name>>
surname=<<surname>>
person-role=<<person-role>>
email-address=<<email-address>>
import-region=<<import-region>>
<br><br>
</$set></$set></$set></$set></$set></$set>
The idea being to extract the nth item in each row and assign it to a variable
What is ODD is the above actually works for the first row
I get a nice line of field=value key/value pairs.
However it displays all rows, but never sets the variables ever again, only for the first case.
This is seriously confusing me.
Any feedback would be welcome.
Regards
Tony