I’m trying to get some data (it's a catalog of AV equipment in each room we support) out of an EE site that uses a Fieldpack Checkbox. I’d like to output a CSV file with a row for each EE entry that includes a column for each checkbox with a boolean value to tell me whether the box is checked or not. Here's the field.

enter image description here

So an entry for "Room 123" that has "Mac mini" checked, "Windows PC" unchecked, and "Control System" checked in the attached picture, I'd like to output a line like:

Room 123,1,0,1,…

I’m definitely open to any thoughts about this approach in general, but assuming this is the right approach, EE/Fieldpack by default only outputs checked items and ignores the existence of unchecked items. I’m having tough time getting EE/Fieldpack to output both checked AND unchecked items.

I thought I might be able use something like:

{if '{equipment:selected option="Computer - Apple Mac mini"}'}1,{if:else}0,{/if}
{if '{equipment:selected option="Computer - Windows PC"}'}1,{if:else}0,{/if}

and so on. This gives me the correct number of columns, but if any of the checkboxes are checked, every conditional evaluate as True. So I get either all 1s, or all 0s.

All advice appreciated, from quick adjustment to approaching this from an entirely different angle. Thanks.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.