Calculated field doesn't work with examples from documentation
For example, I tried the following example from the documentation :
=TEXT(WEEKDAY([Column1]), "dddd")
But it won't work. An exception indicates a syntax error in the UpdateField method. Well, I replaced Column1 with the appropriate (localized) column value, or even tried constant values.
I can use other functions like YEAR, MONTH, but I cannot use CHOOSE or TEXT. I could achieve my goal alone, but nobody works. (I want to group list items by year-month).
I have a localized (well, with a language pack SP2 language pack) MOSS2007 SP2.
PS I have verified that when I create a website in English I can use formulas, but not in the officially localized ones. Anyone have a workaround?
Thanks for the advice.
a source to share
Finally, there is a solution!
Define your computed field inside a function! I don't know if LCID = "1033" helps, but I copied the schema from the i field made on the English version of the site (where the fields are calculated work ...).
<Field Type="Calculated" DisplayName="Hours" Format="DateTime" LCID="1033" ResultType="Number" ReadOnly="TRUE" ID="{49820FB0-705D-4335-AA1F-EF6616D05F59}" StaticName="Hours" Name="Hours" Required="FALSE" Percentage="FALSE" Decimals="2">
<Formula>=IF(ISBLANK(CheckoutTime),0,TEXT(CheckoutTime-CheckinTime,"[s]")/3600)</Formula>
<FieldRefs>
<FieldRef Name="CheckinTime" />
<FieldRef Name="CheckoutTime" />
</FieldRefs>
</Field>
a source to share
When using a language pack, you need to translate the operators into your native language. I had the same problem when running the Dutch language pack.
The documentation is very hard to find, you need to search google for your language for "examples of calculated column formulas"
Here is for example a link to Dutch documentation
Office Online Article in Dutch
and here's the english version:
PS Even the correct language didn't always work. The workaround is to try and create the calculated column as a site column, somehow it works better there and Sharepoint will rebuild you ...
a source to share