Solved

Regular Filter in Smart Object

  • 13 March 2018
  • 3 replies
  • 73 views

I would lke to apply a regular filter to SMO 'Task' to filter out data.

However, there are no reference on the web. Wild guess had got me stressed and still error was resulted.I do not know what text to type for the SMO 'Regular Filter'. (Attached) which includes:

1. ColumnName

2. Condition

3.Comparission

4.ParameterValue. 

 

My desire filter: A field called 'A' to equals to current user's name 'B'.

 

Anyone could help please? Thanks!




icon

Best answer by boringNerd 13 March 2018, 05:25

Hi,



 



The 'Task' SmartObject is used in the Task List in your K2 Management page. To access it, go to your K2 Management page > Users > Task List. Now this brings me to my next point. You can enable SmartObject logging, play around with the filters you can use in the Task List, then check your SmartObject log (servicepackagein.log) to figure out what is the Regular Filter that is being passed in.



 



Here are 2 of the Regular Filter input that I have tested:



 



Filter #1 - Filter tasks from a particular workflow:



[{"ColumnName":"Process Full Name","Condition":"AND","Comparison":"LIKE","ParameterValue":"Test\Workflow"}]



 



Filter #2 - Filter tasks from a particular workflow, and assigned to a particular user:



[{"ColumnName":"Process Full Name","Condition":"AND","Comparison":"LIKE","ParameterValue":"Test\Workflow"},{"ColumnName":"Destination","Condition":"AND","Comparison":"LIKE","ParameterValue":"K2:denallix\administrator"}]



 



So to generate this Regular Filter output, you are already in the right direction. Execute the 'Regular Filter' SmartObject's Serialize methd. Fill in the values you want, and it should generate a string similar to the above.



 



However, the Serialize method only generates the string for 1 filter. If you have multiple filters, you have to use 'Serialize Add Item To Array' method. Fill in the properties except for Serialized Array, then execute. You should notice a string automatically being added into Serialized Array property. Change all your other values, then execute the method again. Each time you do that, it will keep adding more filters to the Serialized Array. Once you are done, you can copy the whole chunk of string from the results panel.



 



As for why you are getting that error, its because the Regular Filter input property is expecting an array, not an object. If you know your JSON, everything within the {} bracket is a single object. All the objects within an array is enclosed within a [] bracket. How to tell the input is expecting an array? Look at the type next to the name of the property. Regular Filter[].

View original

3 replies

Badge +13

Hi,


 


The 'Task' SmartObject is used in the Task List in your K2 Management page. To access it, go to your K2 Management page > Users > Task List. Now this brings me to my next point. You can enable SmartObject logging, play around with the filters you can use in the Task List, then check your SmartObject log (servicepackagein.log) to figure out what is the Regular Filter that is being passed in.


 


Here are 2 of the Regular Filter input that I have tested:


 


Filter #1 - Filter tasks from a particular workflow:


[{"ColumnName":"Process Full Name","Condition":"AND","Comparison":"LIKE","ParameterValue":"Test\Workflow"}]


 


Filter #2 - Filter tasks from a particular workflow, and assigned to a particular user:


[{"ColumnName":"Process Full Name","Condition":"AND","Comparison":"LIKE","ParameterValue":"Test\Workflow"},{"ColumnName":"Destination","Condition":"AND","Comparison":"LIKE","ParameterValue":"K2:denallix\administrator"}]


 


So to generate this Regular Filter output, you are already in the right direction. Execute the 'Regular Filter' SmartObject's Serialize methd. Fill in the values you want, and it should generate a string similar to the above.


 


However, the Serialize method only generates the string for 1 filter. If you have multiple filters, you have to use 'Serialize Add Item To Array' method. Fill in the properties except for Serialized Array, then execute. You should notice a string automatically being added into Serialized Array property. Change all your other values, then execute the method again. Each time you do that, it will keep adding more filters to the Serialized Array. Once you are done, you can copy the whole chunk of string from the results panel.


 


As for why you are getting that error, its because the Regular Filter input property is expecting an array, not an object. If you know your JSON, everything within the {} bracket is a single object. All the objects within an array is enclosed within a [] bracket. How to tell the input is expecting an array? Look at the type next to the name of the property. Regular Filter[].

boringNerd 

Hello,

 

I am trying to filter based on ID and its fail for me "Task smart object"

 

[{"ColumnName":"Id","Condition":"AND","Comparison":"=","ParameterValue":"16107"}]

Reply