Table 10. Filtering
•
•
•
•
•
•
Table 11. CAML Filter variables
• to enter the value in the Value element - <Value Type="Text">Some Text</Value>
• to retrieve the value from an HTTP parameter - <Value Type="Text" Source="HttpParameter" SourceName="NameOfHTTPParameter"/>to retrieve the value from the Session variable - <Value Type="Text" Source="Session" SessionName="SessionName" SourceName="NameOfHTTPParameter" SiteUrl="url" ListName="ListName"/>to compare values of two fields - <Value Type="FieldName" Source="Field">Editor</Value>
• NOT — This is used to negate a condition. For example, to get all employees whose name does not start with M, they syntax is: NOT Employee Name LIKE 'M%'
• AND and OR — This is used to concatenate two conditions. The AND operator takes precedence over the OR. Use parentheses to change the precedence of the operator.
• String — A string is enclosed with single quote; for example 'Accounting'. A string can contain wild-card character % or * when used in conjunction with the LIKE operator. For example: 'M%', 'M*'. A wild-card character is not allowed in the middle of a string. Therefore, this expression is illegal: 'Te*xt'
• Numbers — Numbers are not enclosed. For example: 20, 20.5, 0.5. If you enclose a number with a single quote, it is treated as string.
• Dates — For example: February 5, 2005 11:50 PM is #2005-02-05T23:50:00Z#.
• [ME] — This expression is replaced with the name of the currently logged-in user.
• [TODAY] — This expression is replaced with midnight of today's date.
• [NOW] — This expression is replaced with the current date and time.
• Date function — The following date functions are supported: AddSeconds, AddMinutes, AddHours, AddDays, AddMonths and AddYears. Their syntax is DateFunction(dateValue, number). For example: AddDays([TODAY], 7) adds 7 days to today's date