0

I have a SharePoint enterprise farm 2013 on-premises. and i have a team site which contain a document library. now for this document i define the following versioning settings:-

enter image description here

so currently my document can have a minor version with fraction (1.2, 2.5, etc..) OR major version. and when the document have a minor version i can chose to "Publish a major version". but my question is how i can define a status column inside my document library which will show if the document have "Draft" status when it have a minor version OR if the document have "Publish" status when it have a major version? is this possible? i need something similar to the "Approval Status" field which will be automatically presented when i set the document library to "Require content approval for submitted items"..

3

I'd probably set up a calculated column that looks at the Version. Basically this finds the version, finds the decimal point and if the number after the decimal point is a 0, it's published, otherwise, it's a draft. I haven't tested this in SharePoint, but only in Excel and it worked.

=IF(RIGHT([Version], FIND(".",[Version])-1)="0", "Published", "Draft")

EDIT: Ack, it's one of the columns that gets updated afterwards. You may need to set a simple workflow to capture "Draft" or "Published" - See here

Create a new column called "Draft/Published" where the default value is "Draft". Have a workflow that triggers on Item Modified in which the logic looks something like:

Pause for 1 minute
Find '.' in Version (Output to Variable: index)
Copy from Version, starting at index (Output to Variable: substring)
If substring equals 0 
   Set DraftStatus to "Published"
Else
   Set DraftStats to "Draft"
  • thanks for your reply.. now i tried to created a new calculated column and i define your formula. now if the document have a major version the status will be "Published" ,, but when the document have a minor version the status will be #Name? instead of "Draft" ... also if i refresh the page i will get #Name? even for major versions – john Gu Nov 29 '17 at 15:31
  • Can you see if all the items have a version? Include the "Version" column in the view and refresh. Also, #Name? has something to with the syntax. – Mike Nov 29 '17 at 15:43
  • i actually only have a single document and it have a version = 5.0 and i chose to display the version inside the list view.. but i am getting this value #Name? inside the list view and inside the display form... – john Gu Nov 29 '17 at 15:47
  • 1
    See my edit, it's the Version column that is updated AFTER commit. – Mike Nov 29 '17 at 16:04
  • 1
    You could expose the Version in a list view and educate users that .0 means Published and anything after means Draft – Mike Nov 29 '17 at 16:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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