Author Topic: options for booleans in CSV files  (Read 6360 times)

0 Members and 1 Guest are viewing this topic.

Offline Anson

  • User
  • ***
  • Posts: 46
    • View Profile
options for booleans in CSV files
« on: October 13, 2009, 06:12:27 am »

from a recent thread and some past similar ones, I got an idea for some future improvements which will probably go somewhere in the lower parts of any todo list only, but which still might be nice :-)


the first idea is about small changes to the default CSV export templates

To output boolean fields like viewed and bookmarked, include the line boolvals="yes<->no" in the options section of the template.

it is nice to be able to set the strings for output which are used for true and false. but to make templates work even if people forget (or don't know) to set this line, could this line be included by default in the templates ? It probably shouldn't be much work to do, and also wouldn't hurt if not needed ...

I also have seen that some templates have a delimiter at the end of lines. is that really needed for PVD's CSV files? usually the delimiter is not really a delimiter of all fields, but only a separator between fields, and adding a delimiter at the end causes an additional field (with empty value) to be added as last field of the record.



a second nice (more difficult to implement and also not very important) feature might be to do on purpose what someone falsly has done: setting the strings for true and false for a specific field instead of having only one definition for all booleans in a CSV file. the definition in the options section still would serve as default for those fields without their own definition.

currently, i have to use (among other options)
Code: [Select]
%OPTIONS%
boolvals="true<->false"
%OPTIONS%
%HEAD%onebool;anotherbool;defaultbool
%HEAD%{%value=wish};{%value=viewed};{%value=mybool custom="true"}
to generate something like
Code: [Select]
onebool;anotherbool;defaultbool
false;true;true
true;true;false
false;false;true

the changed syntax would allow for something like
Code: [Select]
%OPTIONS%
boolvals="yes<->no"
%OPTIONS%
%HEAD%onebool;anotherbool;defaultbool
%HEAD%{%value=wish boolvals="wish<->owned"};{%value=viewed boolvals="seen<->tosee"};{%value=mybool custom="true"}
to generate something like
Code: [Select]
onebool;anotherbool;defaultbool
owned;seen;yes
wish;seen;no
owned;tosee;yes


btw: which values are accepted as booleans by the CSV import plugin?
true/false, yes/no, 1/0, something else ?
making this also selectable probably would be overkill and pure SciFi :-)
(and thus also setting own values for different fields is even less important)