# Generate automatic revision's numbering tabular

Situation

I have to make a cover template for a document. At the end of the page, I have to add the revision number with other useful info like this example:

\begin{tabular}{lccl}
Revision 0 & 06-11-2014 & Initial Release & John Smith \\
Revision 1 & 06-12-2014 & Changed something & Joe Blow \\
...
\end{tabular}


Objective

In the TEX document, the user would have to add their revision like this:

\AddRevision{06-11-2014}{Initial Release}{John Smith}
...
\createFrontPage


When generating the PDF, this should automatically generate the tabular above. Note that the revision's number is automatically increase by 1 at each AddRevision.

What I have tried

I'm not familiar with Latex macros, so this is what I have for the moment. I just don't know if I'm close to the solution or if I'm doing totally wrong. Here's the code in my CLS file:

\newCounter{RowCounter}

\newCounter{i}
\newcommand{\RevisionRows}
{
\forloop{i}{0}{\value{i} < \value{RowCounter}}
{
Revision \arabic{i} & \RevDate & \RevDesc & \RevAuthor \\
}
}

\newcommand{\createFrontPage}
{
% some stuff
\begin{tabular}{lccl}
\RevisionRows
\end{tabular}
}


Questions

Is my objective possible ? If yes, What am I doing wrong ? What's the best and clean solution ? Any suggestions are welcome.

Thanks a lot for your help.

-

Here is one way:

## Notes:

I would recommend you put everything prior to the first \AddRevision in a separate package and have the users add the revisions before \begin{document}.

## Code:

\documentclass{article}

%% http://tex.stackexchange.com/questions/175568/build-tabular-content-via-foreach
\newcommand*{\MyTempTableTokens}{}%
\makeatletter
\newtoks\@tabtoks
%%% assignments to \@tabtoks must be global, because they are done in \foreach
\protected@edef\MyTempTableTokens{#1}%
}
%%% variable should always be operated on always locally or always globally
\newcommand*\ResetTableTokens{\global\@tabtoks{}}
\newcommand*\PrintTableTokens{\the\@tabtoks}
\makeatother

\newcounter{RowCounter}
\stepcounter{RowCounter}%
\eAddTableTokens{Revision \arabic{RowCounter} & #1 & #2 & #3 \\}%
}%

\newcommand{\createFrontPage}{%
% some stuff
\begin{tabular}{lccl}
\PrintTableTokens
\end{tabular}%
\clearpage
}

\AtBeginDocument{%
\createFrontPage%
}%

%-----------------------------------------------------------