As you can probably guess from the title, I am trying to use the formula =[Today] in a calculated field. I then use this field to compare two date fields. These represent start and end dates. Lastly, I have a fourth calculated column in which I determine if the "Today" field's value lies within those of Start and End.
Here is an excerpt from my schema.xml:
<Field ID="" Name="ProjectStartDate" DisplayName="$Resources:StartFieldString;" Type="DateTime" Format="DateOnly" Required="TRUE" Group="Site Columns"></Field>
<Field ID="" Name="ProjectEndDate" DisplayName="$Resources:EndFieldString;" Type="DateTime" Format="DateOnly" Required="TRUE" Group="Site Columns"></Field>
<Field ID="" Name="ProjectToday" DisplayName="$Resources:TodayFieldString;" Type="Calculated" Required="TRUE" Group="Site Columns">
<Formula>
=[Today]
</Formula>
</Field>
<Field ID="" Name="ProjectActive" Type="Calculated" ResultType="Boolean" DisplayName="$Resources:IsActiveField;" ReadOnly="TRUE">
<Formula>
=IF(AND([ProjectToday] > [StartDate], [ProjectToday] < [EndDate]), "true", "false")
</Formula>
<FieldRefs>
<FieldRef Name="StartDate" ID=""/>
<FieldRef Name="EndDate" ID=""/>
<FieldRef ID="" Name="ProjectToday"/>
</FieldRefs>
</Field>
I also tried putting =IF(AND([Today] > [StartDate], [Today] < [EndDate]), "true", "false")
into the formula because the <
sign was underlined red in editor.
Does anybody know what I'm doing wrong? I don't get any meaningful error, just the above one. Even in ULS I get nothing.
EDIT: I don't know why but now I get a more meaningful error when deploying it with the <
and >
signs: Illegal syntax. Expecting valid start name character.
I guess this error is about the red underlined <
sign in markup editor. But how to fix if this syntax comes from Microsoft's site?