phpList.org

Importing an user with multiple values in the same checkboxgroup attribute

Hi,

I am trying to import users with more than one value in the same attribute (checkbox group) but nothing does the job.

Lets say i have an attribute called “Business_Activities” and two values in it “Value A” and “Value B”.
I want to import user1@example.com, and this user´s activities matches Value A and Value B, so i want it to have both values A and B checked.

Test 1:
user1@example.com appears two times in the same CSV file, one for Value A and another for Value B:

CSV file:
Email Business_Activities
user1@example.com Value A
user2@example.com Value B
user1@example.com Value B

Result: Phplist will show user1@example.com with Value A only.

Test2:
user1@example.com appears one time only in the CSV file, with both values, using the “,” operator:

CSV file:
Email Business_Activities
user1@example.com Value A,Value B
user2@example.com Value B

Result: Phplist will show user1@example.com with Value A only.
Note: I tried many diferent operators like “,” and “;”, with and without spaces before and/or after the operator.

Test 3:
user1@example.com appears one time only in CSV 1 with Value A and one time only in CSV 2 with Value B.
I first import CSV 1, and then import CSV 2.

CSV 1:
Email Business_Activities
user1@example.com Value A
user2@example.com Value B

CSV 2:
Email Business_Activities
user1@example.com Value B
user2@example.com Value B

Result 1 (Overwrite Existing option checked): After 2nd import, Phplist will show user1@example.com with Value A only.
Result 2 (Overwrite Existing option unchecked): After 2nd import, Phplist will show user1@example.com with Value B only.

I search and read a lot about this but it seems there is nothing i can do to make it importing multiples values in the same attribute for the same subscriber.

Phplist: 3.2.4
SO: CentOS Linux 7.2.1511
php: 5.4.16-36.el7_1
mysql: 5.5.44-2.el7.centos
Browser: Firefox 44.0.2

Any help please?

Attributes are meant to hold a single value and are traditionally a string.
You could try using:

email    attribute
user1@example.com    val_A
user2@example.com    val_B
user3@example.com    val_AB

Or you could create more attributes and import like this:

email    attribute_A    attribute_B    attribute_C
user1@example.com    Yes    No    No
user2@example.com    No    Yes    No
user3@example.com    Yes    Yes    No

Thanks on your reply NYChris.

In fact, i considered that option, but for lists building structure purposes, its just not doable (i´m talking about the AND/OR operators while selecting the final subscribers list using Criteria feature).

On your first example, it is ok for two or three values. If i have 30 or 40, you can imagine how it would be if i have to put every possible combinations. Not doable.
On your second example, i will not be able to use the OR operator anymore (it only applies between values, while the AND applies between attributes).

Also, i have another attributes (Country, etc), so its just not possible to make it a plain csv, with each value in a different column. It has to be an attribute for each entry and then populate each one with respective values (in some cases, hundreds of them).

Lets say i want to send a message exclusively for companies operating in US OR Canada (attribute “Country” with checkboxgroup), AND which business activities are Construction OR Architecture (attribute “Business Activity” with checkgroupbox).
If i have it working as i intend to, it would be just fine to apply criteria selection to send the message only to Contractors or Architects from US or Canada.
If i dont have it working as i intend to, the message will be sent to all users from US and Canada (whatever their business activity), and to all Contractors and Architects (whatever their country).

Thats why checkboxgroup attribute would be perfect for me.
I could use AND plus OR in every Criteria selection to send a given message.

On the other hand, i got the idea that the checkboxgroup type of attribute was created exactly for multiple values in that same attribute.
It is well documented all over the place.
Send a Message: Criteria tab with multiple values

What i´m trying to find out is if i am doing something wrong.

This one should work, so long as you are using tab as the field separator. This is the file that I imported and the checkbox group attribute was updated to have those two values.

email    CBG
xxxxx@yahoo.co.uk    green,yellow
1 Like

Thanks duncanc,
I didn’t realize the attributes were parsed like that.
Learn something new every day.

1 Like

Aha!
I was using the “;” delimiter while importing :slight_smile:

Many thanks duncanc. It works!

Anyone wonna write this up for the manual? Sounds like amazingly useful info! Suggest it goes into the chapter on Adding Subscribers to Lists: manual chapter feedback and discussion or Using Attributes: manual chapter feedback and discussion as the first is already really long.