% This file is embedded in datatool-user.pdf version 3.4.2 2025-11-06
% Example 65 Creating and Displaying a Database with \\DTLaction
% Label: "ex:actions"
% arara: pdflatex
% arara: pdfcrop
\documentclass[12pt]{article}
\pagestyle{empty}
\usepackage{datatool}
% custom expandable command:
\newcommand{\limiteded}{limited edition}
% define a database with the name 'pricelist':
\DTLsetup{store-datum,default-name=pricelist}
\DTLaction{new}% create the default database
% 1st row:
\DTLaction[
 assign={
  Product = {The Adventures of Duck and Goose},
  Quantity = {1,452}, Price = {\$1.99}
 }
]{new row}
% 2nd row:
\DTLaction[
 assign={
  Product = {Duck and Goose on Holiday},
  Quantity = {94}, Price = {\$2.99}
 }
]{new row}
% the next value needs to be expanded:
\DTLaction[
key={Notes}, expand-value={\limiteded} ]{new entry}
% 3rd row:
\DTLaction[
 assign={
  Product = {The Return of Sir Quackalot},
  Quantity = {3}, Price = {\$4.99}
 }
]{new row} 
\begin{document}
% Display the data:
\DTLaction{display} 
\end{document}
