cancel
Showing results for 
Search instead for 
Did you mean: 

UWL API : How to create CompoundExpression object

Amey-Mogare
Contributor
0 Kudos

Hello,

I am using following code line to fetch all UWL tasks in my custom WD Java DC: -

QueryResult queryResult = itemManager.getItemsForView(uwlContext, uwlView, null, null);

Now, I want to apply a filter in above method to fetch tasks only for certain UWL Connectors.

For example,

    connectorId = myconnectorID#1

    and

  connectorId = myconnectorID#2

  and

connectorId = myconnectorID#3

From my study so far about UWL API, I think we have to create & pass last parameter "CompoundExpression" in getItemsForView method above.

I am trying hard to find a way to properly instantiate this CompoundExpression object with correct condition & expression.


Could someone suggest any ideas about this?

Thanks & Regards,

Amey Mogare




Accepted Solutions (1)

Accepted Solutions (1)

valeri_nikolov
Explorer
0 Kudos

Hello Amey,

You need to create as many Expression objects as needed to match your conditions. Use the constructor and set you attribute name, the expected value and you need to create and pass "equals" comparator for the expression.

Then the above needs to be passed as array to CompoundExpression object. Set the logical operation (last parameter) to true to indicate logical "or" for the conditions.

Example:

Expression exp = new Expression("systemId", "myconnectorID#1", new ComparatorEnum("equals"));

Expression exp1 = new Expression("systemId", "myconnectorID#2", new ComparatorEnum("equals"));

Expression[] expArr = {exp,exp1};

CompoundExpression cExp = new CompoundExpression("myFilterName",expArr, null,null,null, true);

That should do the job.

Best regards,

Valeri

Amey-Mogare
Contributor
0 Kudos

Thanks a lot, Valeri!

Code as per NW CE7.3: -

ArrayList<Expression> expressioList = new ArrayList<Expression>();

Expression exp = new Expression("systemId", systemAlias, ComparatorEnum.EQUAL_TO);

expressioList.add(exp);

CompoundExpression allowedConnectorsCompExp = new CompoundExpression("allowedConnectorFilter",expressioList,null,null,true);

QueryResult queryResult = itemManager.getItemsForView(uwlContext, uwlView, null, allowedConnectorsCompExp);

Answers (0)