Hello @tokuchan
To add this scenario you can have multiple query def statements for the specific delivery.
For this you will have to add @id='YOUR_DELIVERY ID' in the where condition.
Once you have the queries for two deliveries you can compare the result if the result if same then you can select Delivery A else let the winner delivery be the final delivery
Here is an example for the first delivery.
var deliveryA = xtk.queryDef.create(
<queryDef schema="nms:delivery" operation="get">
<select>
<node expr="@id"/>
<node expr="@label"/>
<node expr="[@operation-id]"/>
<node expr="[@workflow-id]"/>
<node expr="[indicators/@estimatedRecipientOpenRatio]" alias="openRatio/>
</select>
<where>
<condition expr={"@FCP=0 and [@workflow-id]= " + instance.id +" and @id="+DELIVERY_PRIMARY_KEY_HERE}/>
</where>
</queryDef>).ExecuteQuery()
Similarly you can create the query for delivery B and then compare the openRatio to decide your final delivery.
Thanks,
Manoj