XmlFilter Syntax And Examples
XmlFilter syntax is used in ContentManager and WorkflowTableWatcher.
XmlFilter Syntax-Examples
Percent Sign
The percent sign is a placeholder as soon as the 'Like' statement is set, which is done by Like=”1”. Otherwise, the percent sign is interpreted as a usual character.
Examples:
- <Field Name="Title" Like="1">%shakira%</Field>
„MyShakirA2001“ would match for this filter.
- <Field Name="Title" Like="1">%shakira</Field>
„MyShakirA“ would match for this filter, „MyShakirA2001“ would not.
Simple field
<XmlFilter>
<Field Name="Title">shakira</Field>
</XmlFilter>
Simple field with like
<XmlFilter>
<Field Name="Title" Like="1">shakira</Field>
</XmlFilter>
Logical trees
<XmlFilter>
<And>
<Field Name="Title">shakira</Field>
<Or>
<Field Name="Class">Video</Field>
<Field Name="Class">Audio</Field>
</Or>
<Not>
<Field Name="Invalid">1</Field>
</Not>
</And>
</XmlFilter>
Comparison
<XmlFilter>
<Field Name="Duration">
<Greater>0</Greater>
<LessOrEqual>1000</LessOrEqual>
</Field>
</XmlFilter>
Check for missing custom fields
Example: Check if entry has been loudness analyzed
<XmlFilter>
<And>
<Not>
<Field Name="LOUDNESS/ILK" IsMissing="1"></Field>
</Not>
<Field Name="SoftDeleted">0</Field>
</And>
</XmlFilter>
Example: Check if entry has not been loudness analyzed
<XmlFilter>
<And>
<Field Name="LOUDNESS/ILK" IsMissing="1"></Field>
<Field Name="SoftDeleted">0</Field>
</And>
</XmlFilter>
Time ranges
Example: Created within last 7 days
<XmlFilter>
<Field Name="CreateDate">
<Greater Parse="1">@now()@addtime("-7:00:00:00")</Greater>
</Field>
</XmlFilter>
The attribute Parse="1" activates parsing of the value.
The function addtime uses the same syntax expected by the system method TimeSpan.Parse.
Example: Created within last 1 hour
<XmlFilter>
<Field Name="CreateDate">
<Greater Parse="1">@now()@addtime("-01:00:00")</Greater>
</Field>
</XmlFilter>
Example: BroadcastDate Today+Yesterday
<XmlFilter>
<Or>
<Field Name="BroadcastDate" Parse="1">@now()@addtime("-1:00:00:00")</Field>
<Field Name="BroadcastDate" Parse="1">@now()</Field>
</Or>
</XmlFilter>
Entry part of group
Example: All entries not in a group
<XmlFilter>
<Field Name="HasParent">0</Field>
</XmlFilter>
The field "HasParent" is a virtual field, it does not exist on entry level.
Example: All entries which are at least in one group
<XmlFilter>
<Field Name="HasParent">1</Field>
</XmlFilter>
Entries being a Group
Examples: All entries from type group
<XmlFilter>
<Field Name="Story">2</Field>
</XmlFilter>
Example: Alle entries (that are not a group)
<XmlFilter>
<Field Name="Story">0</Field>
</XmlFilter>
Entries for current user
Use @currentUser() to get the DigaSystem ID of the currently logged-on user
<XmlFilter>
<And>
<Field Name="Author" Parse="1">@currentUser()</Field>
<Field Name="SoftDeleted">0</Field>
</And>
</XmlFilter>
Use @currentUser(LONG) to get the long (or secondary) DigaSystem ID of the currently logged-on user
<XmlFilter>
<And>
<Field Name="Author" Parse="1">@currentUser(LONG)</Field>
<Field Name="SoftDeleted">0</Field>
</And>
</XmlFilter>
Use @currentUser(FULL) to get the full name of the currently logged-on user
<XmlFilter>
<And>
<Field Name="Author" Parse="1">@currentUser(FULL)</Field>
<Field Name="SoftDeleted">0</Field>
</And>
</XmlFilter>
Entries for Custom Flags (Digas\Settings\Flags)
Find entries with a custom flag 7301 and 7302
<XmlFilter>
<And>
<Field Name="SoftDeleted">0</Field>
<Field Name="FlagsEx" Like="1">7301</Field>
<Field Name="FlagsEx" Like="1">7302</Field>
</And>
</XmlFilter>
Find entries with no custom flag and not with the flag 7301
<XmlFilter>
<And>
<Field Name="SoftDeleted">0</Field>
<Not>
<Field Name="FlagsEx" Like="1">7301</Field>
</Not>
</And>
</XmlFilter>
Find entries with no custom flag and not with the flag 7301 and 7302
<XmlFilter>
<And>
<Field Name="SoftDeleted">0</Field>
<Not>
<Field Name="FlagsEx" Like="1">7301</Field>
</Not>
<Not>
<Field Name="FlagsEx" Like="1">7302</Field>
</Not>
</And>
</XmlFilter>