Combining field values in a categorzed column

Hey Everyone,

I have a multi-value Field that contains usernames looked up from our name. So a value might look like this:

user1, user2, user3

I have another field that does the same thing but is not multi-value and a value might look like:

user4

What I need/want to do in my categorized column is of course tie all the docs to say user2 in the category.

What I have done so far is:

@Explode(CClist:AssignedTo; “,”)

and

@If(multiValueField !=“”; @Explode(multiValueField; “,”):singleValueField; singleValueField)

Both of these result in the same thing. Each user has two entries in the column.

So the column looks something like:

user1

user3

user9

user21

user3

user9

How do I get my explode to treat all of them the same so I have one entry for user 3 that shows all of their docs under the category. I know I am not manipulating the lists correctly but for the life of me can’t see the issue?

Any help appreciated.

Shawn

Subject: Combining field values in a categorzed column

Shawn,My recollection is not real clear about the use of @Unique, but take a look at that function. Also, I believe there are some limitations of and settings in the IDE for displaying multi-value fields in a column. Hope this helps.

mit freundlichen Gruessen,

Jan

Subject: RE: Combining field values in a categorzed column

Let me ask a different question.

If I have the following 3 documents selected in my view:

Jane Doe, Mary A. Doe, John Hancock

Jane Doe, John Hancock, Abe Lincoln

Abe Lincoln Mary A. Doe

Now, I want those to appear as categories in a column so Jane Doe would have both records underneath her category?

In other words Mary is listed twice, as is Abe so how do I parse the string out so I get all of the entries to show up under each category (Person) in the column?

Does that make more sense?

Thanks again,

Shawn

Subject: Combining field values in a categorzed column - Solution

Hi Everyone,

I found a way to handle this. First I built a list of comma separated values to reflect my users. Then I used @Transform to create the column entries how I wanted them to be seen.

REM {build a comma separated list of people};

UserList := mvField + ", " + svField;

@Transform(UserList; userName; @Name([CN];@Implode((@LeftBack(userName; " ") + " " + @RightBack(userName; " ")))))

I removed the middle initial from the users by using left and right back so I ended up with a string that looked like ‘firstNamelastName’ and the rest, as they say was history!

Thanks everyone for the help along the road!!

Cheers,

Shawn

Subject: RE: Combining field values in a categorzed column - Solution

That formula may not always give what you are expecting. You’re making the assumption that the last name (or the first name) is a single word. What about a person with a last name of “Van der Wall”?

Andre posted a formula earlier that should work. Here’s a slight modification that should also cover the problem you appear to have where your multi-value field is stored as a single string:

mvNames := @Explode(multiValueField; “,”);

@Trim(mvNames : singleValueField);

Use whatever is your separator in the multiValueField. Combine values into a list using a colon. The trim will remove any blanks either from the mvNames temp variable or from singleValueField.

Subject: Combining field values in a categorized column - Formula Correction

Sorry about that, here is the actual correct formula I used to get it working.

Cheers,

Shawn

REM {build a comma seperated list of people};

@If(mvField = “”; assignedUserList := svField; assignedUserList := svField + ", " + mvField);

REM {Perform the parsing function to create an entry for “FirstName LastName”};

@Transform(assignedUserList; userName; @Left(@Name([CN];userName); " ") + " " + @RightBack(@Name([CN];userName); " "))

Subject: RE: Combining field values in a categorized column - Formula Correction

Thanks Everyone, that is the ticket!

James’ formula was bang on. I think I neede the @Trim as Andre’s Formula produced irregular results.

Again, much appreciated.

Shawn

Subject: RE: Combining field values in a categorzed column

The problem is not with your formula. The problem is that the categorized column must be the first sorted column in your view.

(Actually, it doesn’t have to be the first sorted column, but if it is not, the previous sorted columns have to be such as to make all documents with the same category appear consecutively. For instance, you would do this when you want to list categories out of alphabetical order – Sunday, Monday, Tuesday… you could have a hidden sorted column that uses @Weekday to put them in day number order instead of alphabetical).

Incidentally, if your field is really multivalued you don’t need to use @Explode – it is already exploded. So it is more efficient to write:

@If(multiValueField !=“”; multiValueField : singleValueField; singleValueField)

Also, I notice this formula assumes that singleValueField is never blank; is that assumption correct?

Subject: RE: Combining field values in a categorzed column

Hey Andre and Jan,

Jan,

I tried the @unique and that didn’t seem to help, although it seems like it makes sense to put it in there so I left it.

Andre,

The column is the first categorized/sorted column in the view.

If I don’t do the explode and specify the comma separator I get the full text string in the column like this:

user3

user3, user4

user3, user5 , user11

user3, user6, user11

The multi-value separator for the column is set to ‘New Line’ but changing that value doesn’t seem to accomplish anything. I am reading the designer help on that right now.

Thanks for the feed back,

Shawn

Subject: RE: Combining field values in a categorzed column

Ah. Then it is not a real multivalued field. I’d like to point out that if you explode on “,”, when the string contains “name1,name2”, you get the values “name1” and “name2” (which is not equal to “name2”).

Perhaps the field is multivalued on the form, but that only matters when you’re editing the document. If you have code somewhere that assigns the field, you have to assign it from a multivalued source, not set it to a string containing commas.

Subject: RE: Combining field values in a categorzed column

Sorry Andre,

I don’t follow.

let me outline the field properties:

It is a Dialogue List field that is editable that has ‘Allow Multiple Values’ checked. That is how I determined it was a multi-value field.

That being said, I am wrong more than I am right and in this particular matter, I don’t like my chances!!

Could you elaborate a little more on this piece:

“If you have code somewhere that assigns the field, you have to assign it from a multivalued source, not set it to a string containing commas.”

The field is a string containing commas and as you point out above.

I also add another field to the end with a + “,” svField to get on string that has all the people I want in the categorized column.

What I think this should do then is sort all of the people and create a category for each person. I have been playing a lot with this over the last two days and the closest I get is double entries for every person.

Any additional guidance is tremendously appreciated.

Subject: Multi-value fields may not contain multi-values

What Andre is getting at is that your field design doesn’t necessarily have anything to do with how the data is stored in the field. i.e. I can have a multi-value field (design - that is comma separated) that I populat via an agent. In the agent I can do something like this:

FIELD A := “Jim, Andre, Sharon”;

As far as the document is concerned I now have a single value in my A field. If I edit and re-save the document from the UI I would have 3 separate values of “Jim” “Andre” “Sharon” stored in my A field.

Do this… select a document from the view (highlight it… don’t open it). Right click on the document and select document properties. On the second tab of the properties dialog find your field in the left side and click once on it. The value of the field will be showing in the right side of the properties box.

Is the value shown as

“Jim, Andre, Sharon”

or

“Jim”

“Andre”

“Sharon”

The first is a single value, the second is multi-value. By re-saving the document via the UI the field design will take over and split my single value into multiple values.