Skip to main content
Hello,

I'm trying to use the WorklistCriteria object to sort my worklists by values in a ProcessInstance XMLField. I've looked at the sample code in K2ROM.chm, but I can't seem to get the syntax right for drilling down in the XMLFields.

My WorklistItem has a ProcessInstance XMLField named "Entity" that stores an XML representation of the entity associated with that WorklistItem, and I need to be able sort the worklist based on different attributes of the entity's XML representation.

For example, if my XMLField named "Entity" looks like:
<Entity id="123"><Type id="234"/><Name>entity_name_value</Name></Entity>

What would be the appropriate values to pass to AddSortField in order to sort based on Entity Type ID, or Entity Name? I've been trying a number of variations on the code below, but can't seem to find anything that works the way that I want.
oWorklistCriteria.AddSortField(SourceCode.K2ROM.WCField.ProcessXml, "/Entity/@Id", SourceCode.K2ROM.WCSortOrder.Ascending)

Can the SubField parameter to AddSortField take an XPATH query string, or is there another way that I can do this?

Thank you in advance for your help.
Worklist items can not be sorted on process xml fields through the WorklistCriteria object. Mainly due to the fact that you can not pass in an XPath as a parameter. The only workaround I can recommend would be to 'clone' the Entity element into a process level datafield and sort on this datafield.

Regards,
Ockert
I do not know how you retrieve/put together your xml, but use another object to sort your data. Take the xml and use Dataview.sort or grid etc.

Just a suggestion.

Reply