1

I have a list with a Choice field that allows user to "fill-in" items. I want to somehow determine the choice options that were added as "fill-in" items by users. Or, determine the list of original choice options.

Either way, I need a method of distinguishing which choices are user inputted vs original choice items when the list was created.

I am using SharePoint 2010 Enterprise. Thanks,

1 Answer 1

3

Descerning the original values from the user filled-in is easy, as the additional values entered by a user are not added to the original choice field definition, which will remain unaltered.

So, in order to retrieve all the list items where the choice field value is not one of the predefined values, you need to build a CAML query with the NEQ operator on the choice field. Eg:

<Where>

<Neq>

<FieldRef Name='MyField'/><Value Type='Choice'>Choice1</Value>

</Neq>

</Where>

So, to say it in English, the idea is to retrieve all the list items where the choice field value is not equal to any of the predefined values. You can get all the predefined values of a choice field with both JSOM and C#. For an example of using the JSOM see this post on SE

UPDATE

See the screenshots below to better understand what I mean:

  1. here's the original choice field definition enter image description here

  2. here's the new item form. enter image description here

As you can see on the left, the list has two items with custom (filled-in) values for the choice field (custom value1 and custom value2). However, the dropdown on the new form, still shows only the 3 choices that were originally set when creating the ChoiceField column.

This is what I meant: for any value you can find on an item ChoiceField field, you can always tell if it is one of the predefined values (Choice #1;Choice #2;Choice #3) or a custom value inserted by the user.

6
  • Actually you are right, I mis-understood the question.. Commented Feb 11, 2014 at 9:03
  • Hi MdMazzotti, thanks for your post but the original values are not in the choice field definition. I went into List Settings>> Chose my choice field and copied all the options and compared it to what is being displayed in the actual list drop down. They are exactly the same.
    – Haroun A.
    Commented Feb 11, 2014 at 18:55
  • Of course they are the same. This is exactly what I said. The values you see in the drop down are what I called the predefined values, that is the values you see in the choice field definition. And this is how you can tell whether the value you see in a list item choice column is a predefined or filled-in one
    – MdMazzotti
    Commented Feb 12, 2014 at 0:33
  • Please clarify, I am not understanding. (" And this is how you can tell whether the value you see in a list item choice column is a predefined or filled-in one")Thanks
    – Haroun A.
    Commented Feb 14, 2014 at 1:24
  • @Rounn updated my answer to hopefully make it clearer to you
    – MdMazzotti
    Commented Feb 14, 2014 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.