Getting values from multi select fields

Mark Elliott asked on September 25, 2014 18:46

Probably my biggest quandary is how to query off the values stored in a multi select field. I have created a document type like this:

Items Item Type item 1 1|3|5 item 2 3|5|6 item 3 1|2|5

and then of course I have a document type with item types

Item Type Desc 1 Type 1 2 Type 2 3 Type 3 4 Type 4 5 Type 5 6 Type 6

Now of course I would like to get a list of a count of items in each type:

Type 1 (2) Type 2 (1) Type 3 (2) Type 5 (1) Type 6 (1)

I could go into SQL and write some scripts to split the data in that field and then run a count but since Kentico's way of storing the data is this pipe-delimited field I was wondering if there was a better way to accomplish this.

Thanks

Recent Answers


Joshua Adams answered on October 3, 2014 18:51

You could use a custom transformation to handle this. I usually use this approach for my fields that store multiple values.

0 votesVote for this answer Mark as a Correct answer

Mark Elliott answered on October 3, 2014 19:06

Thanks. Last night I wound up writing a custom Split function in SQL Server and then a query in Kentico using cross apply to get the values.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.