1

I am designing an address book using the CSV parser in How to create form letters from spreadsheet data in ConTeXt?. Some persons have an academic title, while others not. Some also have a job address, others not. My layout depends on whether these data fields contain information or not. I can't figure out how to test, if a CSV field is empty or not. My first idea was to use something like \doifnotempty{\expanded{\insert[acadtitle]}{(\insert[acadtitle])}, but that always executes the command regardless whether the field is empty or not. Any hints? Thanks.

6
  • Try \ifx\@empty#1 where #1 is what you are testing. Don't forget the \makeatletter ... \makeatother. May 20, 2015 at 18:13
  • @JohnKormylo I am using ConTeXt. How could I achieve this with the \doif commands? May 20, 2015 at 20:30
  • No idea. But the etoolbox package has \ifdefempty which is supposed to do the same thing. May 21, 2015 at 4:09
  • 2
    If \insert is an expandable command then \doifnotempty{\insert[acadtitle]} should work (no need to \expand). If it is unexpandable, then you can try \doiftextelse{\insert[acadtitle]}{true}{false}. If these don't work, then please post a minimal working example.
    – Aditya
    May 21, 2015 at 5:14
  • 4
    I'm voting to close this question as off-topic because the issue was apparently caused by a malformatted CSV file. Jan 30, 2018 at 1:15

0

Browse other questions tagged .