About
Shop
LaTeX
Software
Books
Gallery
News
Contact
Blog
Settings
Account
Latest news 2024-12-13: Ebook sale (12th December 2024 – 1st January 2025): cybercrime fiction short stories Unsocial Media and Smile for the Camera free; crime fiction short story The Briefcase free; short story noir crime fiction I’ve Heard the Mermaid Sing free; crime fiction novel The Private Enemy US$1.99; illustrated children’s story The Foolish Hedgehog US$0.99.

Fetching a Customer's Details With Expansion (SQL)

The customer.dbtex file is created using:

datatooltk --output customer.dbtex --sqldb samples --sqluser sampleuser --sqlpassword sample-passwd --sql "SELECT title, surname, address1, address2, town, county, countries.name AS country, postcode FROM people, countries WHERE surname='Parrot' AND people.country = countries.code"
Alternatively you can use datatooltk-gui to import the data and save it to a file called customer.dbtex.
\documentclass[captions=tableheading]{scrartcl}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{datatool}

\DTLloaddbtex{\customer}{customer.dbtex}

\begin{document}

\DTLassign{\customer}{1}{%
  \Surname=surname,%
  \Title=title,%
  \AddressI=address1,%
  \AddressII=address2,%
  \Town=town,%
  \County=county,%
  \Postcode=postcode,%
  \CountryName=country%
}

\begin{tabular}{l}
  \Title\ \Surname\\
  \AddressI\\
  \AddressII\\
  \Town\\
  \County\\
  \Postcode\\
  \CountryName
\end{tabular}

\end{document}

Download sample-xassign-sql.tex or sample-xassign-sql.pdf.

© 2015 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs