How to return unique value from xquery for by searching list of values
Hi
My response is ProductList and ItemList. Based on the passed in Item/Type the xquery should check the following conditions are return unique value
If passed in value exists then
return "exists"
else if (count(item)>5) then
return "maxLimit"
else
"notExist"
<ProductIdentificationResponse>
<!-- LIST OF PRODUCTS -->
<ProductList>
<Product>
<!-- LIST OF ITEMS -->
<ItemList>
<Item>
<Type>ITM22</Type>
<Value>5555</Value>
</Item>
<Item>
<Type>ITM22</Type>
<Value>6666</Value>
</Item>
<Item>
<Type>ITM22</Type>
<Value>7777</Value>
</Item>
</ItemList>
</Product>
</ProductList>
</ProductIdentificationResponse>
I have return the xquery as follows but not working
for $x in $ProductIdentificationResponse1/ProductList/Product/ItemList/Item
return
if ($passedParam/text() = $x/Value/text()) then
( "Exists" )
else if (count( $ProductIdentificationResponse1/ProductList/Product/ItemList/Item) > 5) then
("maxLimit")
else
("notExist")
};
Any help will be appreciated
Thank you
Edited by: user11310683 on Sep 2, 2011 4:25 AM