2

I'm working on making a simple tool to generate burn down reports/track task progress; this is my first foray into more complicated table manipulation so there's probably something pretty basic I'm not understanding. Hopefully someone wiser can set me straight :-)

I can create a new table and get today's date into it. It displays correctly when typeset (albeit duplicated and with extra commas). When I output that table to a file (output.dat), what is stored isn't the date, but \today. That's likely due to using create col/set.

My guess is that the "save" functionality isn't applying any typesetting to the data, so what I actually want is to store the YYYY-MM-DD date string to the table instead of \today. I've tried multiple methods of storing today's date into the table (based on the pgfkeys/pgfplotstable documentation), but am evidently going about it the wrong way.

What's the proper way to get this to format as a date when saving to an output file? Any assistance would be appreciated!

Here's my MWE:

    \documentclass{article}
    \usepackage{pgfplotstable}
    \usepackage[yyyymmdd]{datetime}
    \renewcommand{\dateseparator}{-}

    \pgfplotsset{compat=1.9}

    \begin{document}

    The current date is: \today

    \pgfplotstablenew[
        columns={Date},%
        create on use/Date/.style={create col/set={\today}, date type={\year-\month-\day}},%
    ]{1}\datestable

    \pgfplotstabletypeset[columns/Date/.style={string type}]{\datestable}

    \pgfplotstablesave[
        col sep=comma,%
        columns={Date},%
        columns/Date/.style={string type},%
    ]{\datestable}{output.dat}

    \end{document}

Contents of output.dat:

Date,
\today ,
\today ,
  • I ended up resolving my issue using – TexItUp May 23 '16 at 16:53
1

I ended up resolving my problem by using

    create on use/Date/.style={create col/set/.expanded={{\isodate}}, date type},

This allows the set value to be expanded prior to storage.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.