Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass{article}
- usepackage{filecontents}
- usepackage{datatool}
- begin{filecontents*}{A.csv}
- date,colA
- 2016-01-01,1
- 2016-01-02,4
- 2016-01-03,2
- end{filecontents*}
- begin{filecontents*}{B.csv}
- date,colB0,colB1,colB2,colB3
- 2016-01-01,2,b10,b11,b12
- 2016-01-03,4,b20,b21,b22
- end{filecontents*}
- begin{filecontents*}{D.csv}
- date,colD0,colD1,colD2,colD3
- 2016-01-01,2,d10,d11,d12
- 2016-01-03,4,d20,d21,d22
- end{filecontents*}
- % DTLloaddb{A}{A.csv}
- DTLloaddb{B}{B.csv}
- DTLloaddb{D}{D.csv}
- DTLloaddb{E}{A.csv}
- DTLforeach{E}{Date=date}{
- DTLgetvalueforkey{tmp}{colB0}{B}{date}{Date}
- %DTLgetvalueforkey{tmp}{colB1}{B}{date}{Date}
- DTLappendtorow{colB0}{DTLifnull{tmp}{0}{tmp}}
- }
- begin{document}
- DTLsetseparator{,}
- DTLsetdelimiter{"}
- DTLsavedb{E}{E.csv} % doesn't write if before begin{document}
- DTLdisplaydb{E}
- end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement