what is the order that columns that are calculated from other columns get resolved? RRS feed

  • Question

  • I currently have a doc lib called documents. In this library there is a requirement to have the current version visible in the default view. i have used the OOTB site column called 'Version' and it accomplishes this.

    now I have been asked to create columns called Major and Minor to represent the the major and minor values in a whole number. so i need to split the version value. So if the version is 2.3 then 2 goes into the major column and 3 goes into the minor.

    I created calculated columns that round down the version value for major and I subtract the major version from the version value to get the minor value.

    This works great on the first load but whenever a doc is edited and the minor value should go up 1, the values for both columns become 0. I assume that the order that the columns get 'processed' is not favourable for my solution.

    I have considered a workflow to populate the major and minor columns but there is no 'rounddown' function in workflows.

    Is there a way to manipulate the order of the columns getting their values OR another process by which this can be accomplished (maybe a powershell script can be initiated from the workflow that writes the correct values to the columns)?

    Any help would be appreciated.



    Tuesday, February 14, 2017 9:19 PM

All replies

  • Hi,

    You could get file version by REST api in workflow.


    You could check below threads about calling REST api in workflow.

    Best Regards,


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact

    Wednesday, February 15, 2017 3:03 AM
  • Hi Lee,

    Thanks for the response. The information was helpful but how do i get the value into the major and minor columns?

    Can I put the REST call into a field as a calculated field?


    Wednesday, February 15, 2017 6:21 PM
  • Hi,

    I did some test by workflow but seems it’s a not so good solution as it would cause item version increase.

    So you could try with event receiver, when an item was edit, update the major/minor column(I think you don’t need calculate field by this solution, sample text field should fine) value.

    Here is sample code for your reference.

                    using (DisabledEventsScope scope = new DisabledEventsScope())
                        SPListItem item = properties.ListItem;
                        SPListItemVersion currentVersion = item.Versions[0];
                        string versionStr = currentVersion.VersionLabel;
                        string vMajor = versionStr.Substring(0, versionStr.IndexOf('.'));
                        string vMinor = versionStr.Substring(versionStr.IndexOf('.') + 1);
                        item["VMajor"] = vMajor;
                        item["VMinor"] = vMinor;
                catch (Exception ex) {
                    string exPoint=ex.StackTrace;
    class DisabledEventsScope : SPItemEventReceiver, IDisposable
            // Boolean to hold the original value of the EventFiringEnabled property 
            bool _originalValue;
            public DisabledEventsScope()
                // Save off the original value of EventFiringEnabled 
                _originalValue = base.EventFiringEnabled;
                // Set EventFiringEnabled to false to disable it 
                base.EventFiringEnabled = false;
            public void Dispose()
                // Set EventFiringEnabled back to its original value 
                base.EventFiringEnabled = _originalValue;

    For SharePointevent receiver, you could check below link.

    You need implement the events based on your scenario.

    Best Regards,


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact

    Thursday, February 16, 2017 8:19 AM
  • Hi

    in your calculated column

    create a new column, set as default with 0 ( for new

    insert IF conditions and make decisions based on current version values and add 1 to that value

    Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.

    Thursday, February 16, 2017 9:42 AM