Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a site that has a document library and I made a calculated field for the content type called status that determines if a file is published or not.

I used =IF(MOD(Version,1)<>0,"Draft","Published") since the Published files are the only ones with whole values.

This is not working when a new file is added to the library. What can I do?

share|improve this question
add comment

2 Answers 2

Try this =IF(Version<1,"Draft",IF((Version-FLOOR(Version,1)=0),"Published","Draft"))

share|improve this answer
    
Thank you for the reply. I will try this but it seems to only go to 1. Our version can be anything and only whole numbers are published. Also, My formula worked for documents that were already in the list, but not for new ones. I wondered if that was from not calculating at the right time? –  Scott Apr 20 '12 at 12:09
    
Wait, no I was wrong. This addresses teh version just fine. It still doesn't update once published. –  Scott Apr 20 '12 at 12:21
    
Are you publishing as a major version? –  sssreddy Apr 20 '12 at 14:28
    
I took a screen shot but don't now how to post it here. Anyway when a new document is added to the list, using '=IF(Version<1,"Draft",IF((Version-FLOOR(Version,1)=0),"Published","Draft"))' will show the document as draft. When I click properties the version shows as 0.1 Later when I hit publish the version changes to 1.0 but it still says draft. Do I need to do something to update the field? If I edit the document and it shows published then it goes to draft. But if I click publish it doesn't change from draft. The only way it updates is if I modify the column and then it changes –  Scott Apr 20 '12 at 18:46
add comment

Doin this with a calculated field could be really tricky cause they' re only updating on add / or edit and it does somehow ignore the publishing workflow - as far as i know from tryin to achieve that some weeks ago..

share|improve this answer
    
I assumed that the calculated fields were calculated when viewed. Is there a better way to do this? –  Scott Apr 20 '12 at 12:19
    
Well, what i did to achieve what you wanted i analysed the version column - to see on its format if its a major version (which only published are).... Well i ended up in the problem you have today.. dk.. You could easily add an eventreciever to that library, and check if properties.ListItem.ModerationInformation is SPModerationStatusType.Approved on ItemUpdating -; if yes set an hidden boolean field to true.. –  fr34kyn01535 Apr 20 '12 at 12:38
    
Sorry, you have to check that in "ItemUpdated" :D Well i refered to social.msdn.microsoft.com/forums/en-US/sharepointdevelopment/… so check this out ;-Sven –  fr34kyn01535 Apr 20 '12 at 12:42
    
Is this using Visual Studio and code or soemthing that is done in teh Sharepoint web interface? I am only learning how to get the web interface to work and have no idea even how to start modifiying things in Visual Studio for Sharepoint. I can code in Visual Basic and c# no problem, but have never done it with Sharepoint. –  Scott Apr 20 '12 at 13:01
    
Ya, it is - and i think you have no chance without.. Maybe you can test, creating a workflow in designer.. –  fr34kyn01535 May 3 '12 at 13:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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