I made a survey to register the knowledge inside my organisation. e.g.:
Question:
Microsoft Development;
Subquestions:
SharePoint
CRM
WCF
etc...
People can rate their proficiency using a rating scale. The min value being 0 and the max value 6.
I wan't to retrieve the values from the responses in a new graphical feature.
I'm new to this and this is my code so far:
var thisWeb = SPContext.Current.Web;
foreach (SPList item in thisWeb.Lists)
{
if (item.Title.Contains("Knowledge"))
{
foreach (SPListItem child in item.GetItems())
{
foreach (SPField field in child.Fields)
{
Debug.WriteLine(field.Title);
if (field.TypeAsString == "GridChoice")
{
var ratingscale = field.GetFieldValue(field.);
//var x = ratingscale.GetFieldValue(ratingscale.Choices.ToString());
}
}
}
}
}
}
foreach (SPField field in item.Fields)
{
if (field.Type == SPFieldType.GridChoice)
{
SPFieldRatingScale srsc = (SPFieldRatingScale)field;
Debug.WriteLine(srsc.GetFieldValueAsText(item[field.Title]));
}
}
This will return you values in format below. question 1;#answer#question 2;#answer# .....