Janis Veinbergs
Janis Veinbergs

Reputation: 6988

Calculated field not working with examples from documentation

For example, I tried following example from documentation:

=TEXT(WEEKDAY([Column1]), "dddd")

But it won't work. Exception says there is a syntax error at UpdateField method. Well, i replaced Column1 with appropriate (localized) column value or even tried constant values.

I can use other functions, like YEAR, MONTH, but can't use CHOOSE or TEXT. I could achieve my goal with either one, but none works. (I want to group list items by Year-month).

I have a localized (well, with a language pack. SP2 language pack) MOSS2007 SP2.

P.S. I checked that when I create an English version site, then I am able to use the formulas, but not on officially localized ones. Does anyone have a workaround?

Thank you for advice.

Upvotes: 1

Views: 1079

Answers (2)

Janis Veinbergs
Janis Veinbergs

Reputation: 6988

Finally there is a solution!

Define your calculated field within a feature! I don't know if LCID="1033" helps here, but i copied schema from a field i made on English version of site (where calculated fields 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>

Upvotes: 1

Colin
Colin

Reputation: 10638

When using a language Pack, you need to translate the operators to your own language. I had the same problem while running a Dutch Language Pack.

The documentation very hard to find, you have to search google for your own language for "examples of calculated column formulas"

Here for instance is the link to the Dutch Documentation

Office Online Article in Dutch

and here's the english version:

Office Online Article in English

P.S. Even the correct language not always worked. A workaround is to try to create the calculated column as a site column, somehow it works better there and Sharepoint will tralsate for you.....

Upvotes: 1

Related Questions