Filtering task based on the properties using REST API

cancel
Showing results for 
Search instead for 
Did you mean: 
Tabu
Member II

Filtering task based on the properties using REST API

Hi,
I am trying to filter the tasks based on the property filtration using the below code taken from TaskInstancesGet class. I was able to fetch all the properties whose values are Strings but couldn't fetch the values which are numbers or dates.

if (list_1 != null)
{
for (Object list_2 : list_1)
{
int propQNameEnd = list_2.toString().indexOf('/');
if (propQNameEnd < 1)
{
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("Ignoring invalid property filter:" + list_2.toString());
}
break;
}
String propValue = list_2.toString().substring(propQNameEnd + 1);
if (propValue.isEmpty())
{
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("Ignoring empty property value filter [" + propValue + "]");
}
break;
}
String propQNameStr = list_2.toString().substring(0, propQNameEnd);
QName propertyQName;
try
{
propertyQName = QName.createQName(propQNameStr, namespaceService);
}
catch (Exception ex)
{
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("Ignoring invalid QName property filter [" + propQNameStr + "]");
}
break;
}
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("Filtering with property [" + propertyQName.toPrefixString(namespaceService) + "=" + propValue + "]");
}
propertyFilter.put(propertyQName, propValue);
taskQuery.setProcessCustomProps(propertyFilter);
}
}

Please do check the code and let me know if there are any changes in the above so that i can filter the properties whose values are numbers or dates.

Any help would be appreciated..Thank you!

4 Replies
abhinavmishra14
Advanced

Re: Filtering task based on the properties using REST API

@Wilbert1542 Posting spam is not allowed in the forum

~Abhinav
(ACSCE, AWS SAA, Azure Admin)
sanjaybandhniya
Intermediate

Re: Filtering task based on the properties using REST API

You can add like this: 

 

propertyFilter.put(WorkflowModel.PROP_START_DATE, "dateValue");
propertyFilter.put(WorkflowModel.PROP_PRIORITY, "1");

Hayes84
Member II

Re: Filtering task based on the properties using REST API

Glad you like it. We have been using this for several weeks now and it seems to be going nicely.

Tabu
Member II

Re: Filtering task based on the properties using REST API

Thanks for your reply!
But this can be used to filter out the date of a Workflow
I want to filter the tasks by their start date (Task Start Date)
So, if there's any solution please do provide it.