1

I am facing an issue while I need to increase number of decimal places of list calculative column. I need it in SharePoint online - unfortunately the list contains more than 40K records (and increasing). As the list contains huge records, I get the error message "The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator." - when I go to change the decimal places from 2 to 3 and save the column edit option.

Obviously - the threshold issue is preventing me to modify the column settings but getting no point to do this. For List views I have optimized column with indices and filter - so I can manage views as my needs. for this modification of column settings getting no clue.

Appreciate in advance!

2

2 Answers 2

0

You can try to add an index to the column as you have exceeded the List View Threshold and been blocked. In SharePoint Online, you can manually add an index to a list of any size. Please refer to these articles for more information: Add an index to a SharePoint column

1
  • Thanks Jerry- Actually I have so many columns - already the number of index columns exceeded (20 in SPO) and that part has been taken care of. Its not helping me a lot. Apr 20, 2020 at 11:08
0

All - Using CSOM C#) application came across a solution:

    private static void UpdateCalculativeColumnDecimal(ClientContext clientContext)
    {
        string listName = "ListName";
        string fieldName = "columnName"; //calculated column
        string newValue = "2";           //--Decimal place

        List list = clientContext.Web.Lists.GetByTitle(listName);

        try
        {
            // fetch the fields from this list
            FieldCollection fields = list.Fields;
            clientContext.Load(fields);
            clientContext.ExecuteQuery();

            Field field = fields.GetByTitle(fieldName);
            clientContext.Load(field);
            clientContext.ExecuteQuery();

            XmlDocument doc = new XmlDocument();
            doc.LoadXml(field.SchemaXml);
            XmlNode fieldNode = doc.SelectSingleNode("Field");
            XmlAttribute decimalAttribute = fieldNode.Attributes["Decimals"];
            if (decimalAttribute == null)
            {
                decimalAttribute = doc.CreateAttribute("Decimals");
                fieldNode.Attributes.Append(decimalAttribute);
            }

            decimalAttribute.Value = newValue;
            field.SchemaXml = doc.OuterXml;
            field.UpdateAndPushChanges(true);
            clientContext.ExecuteQuery();

            Console.WriteLine("Done!");
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
            Console.WriteLine(ex.StackTrace);
        }
    }

Note: ClientContext has been passed to the method as SP site connection context.

Your Answer

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

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