English > Feature Suggestions

options for booleans in CSV files

(1/1)

Anson:

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


--- Quote from: rick.ca on August 08, 2009, 11:54:11 am ---To output boolean fields like viewed and bookmarked, include the line boolvals="yes<->no" in the options section of the template.
--- End quote ---

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: ---%OPTIONS%
boolvals="true<->false"
%OPTIONS%
%HEAD%onebool;anotherbool;defaultbool
%HEAD%{%value=wish};{%value=viewed};{%value=mybool custom="true"}
--- End code ---
to generate something like

--- Code: ---onebool;anotherbool;defaultbool
false;true;true
true;true;false
false;false;true

--- End code ---

the changed syntax would allow for something like

--- Code: ---%OPTIONS%
boolvals="yes<->no"
%OPTIONS%
%HEAD%onebool;anotherbool;defaultbool
%HEAD%{%value=wish boolvals="wish<->owned"};{%value=viewed boolvals="seen<->tosee"};{%value=mybool custom="true"}
--- End code ---
to generate something like

--- Code: ---onebool;anotherbool;defaultbool
owned;seen;yes
wish;seen;no
owned;tosee;yes

--- End code ---


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)

Navigation

[0] Message Index

Go to full version