ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » IIB9: Mapping Node fn:count/fn:foreach

Post new topic  Reply to topic
 IIB9: Mapping Node fn:count/fn:foreach « View previous topic :: View next topic » 
Author Message
akil
PostPosted: Thu Jul 23, 2015 6:55 am    Post subject: IIB9: Mapping Node fn:count/fn:foreach Reply with quote

Partisan

Joined: 27 May 2014
Posts: 338
Location: Mumbai

Hi

I am using a mapping node, to create an output that looks like the following

Code:

<output>
 <numResults/>
  <resultSet>
     <item/>
      <item/>
      ....
   </resultSet>
</output>


The number of items in the resultSet are to be limited to what the client wants.

I can achieve this by putting a 'condition' on the 'for-each' transform that is creating the 'item' elements.

I am unable to figure out how do I set the numResults correctly.. as I've to set this as the minimum of the input value and the count of 'items' in the result set.

Any ideas?
_________________
Regards
Back to top
View user's profile Send private message Visit poster's website
nelson
PostPosted: Thu Jul 23, 2015 8:00 am    Post subject: Reply with quote

Partisan

Joined: 02 Oct 2012
Posts: 313

What about wiring your output element as an input element of numResults, using count function? I have not tried this, but.. I guess it could work...
Back to top
View user's profile Send private message
martinb
PostPosted: Wed Jul 29, 2015 12:45 am    Post subject: Reply with quote

Master

Joined: 09 Nov 2006
Posts: 210
Location: UK

Yep

Wire a Custom XPath from the source ResultSet to the "numResults" and use, assuming you "max items" limit is 10

if (fn:count($ResultSet) < 10) then fn:count($ResultSet) else 10
Back to top
View user's profile Send private message
akil
PostPosted: Wed Jul 29, 2015 11:53 pm    Post subject: Reply with quote

Partisan

Joined: 27 May 2014
Posts: 338
Location: Mumbai

Thanks martinb, this worked.

One small quirk though, the toolkit gives a 'warning' as follows :

Code:
The else element in XPath if (fn:count($Benef) < $numBeneficiaries3) then  fn:count($Benef) else $numBeneficiaries3 was not found in the XML Schema.


It does still work on the runtime, so going ahead for now..
_________________
Regards
Back to top
View user's profile Send private message Visit poster's website
martinb
PostPosted: Thu Jul 30, 2015 12:03 am    Post subject: Reply with quote

Master

Joined: 09 Nov 2006
Posts: 210
Location: UK

Hi akil

Glad to hear you got this working.


"small quirk, the toolkit gives a 'warning' ..."

That will be a bug in the XPath validation.. the thread does not state what version you have, I'd hope it might already be fixed in latest.
Back to top
View user's profile Send private message
akil
PostPosted: Thu Jul 30, 2015 1:31 am    Post subject: Reply with quote

Partisan

Joined: 27 May 2014
Posts: 338
Location: Mumbai

Hi

I've 9.0.0.2 ..Will try 9.0.0.3 and check

Regards
Akhilesh
_________________
Regards
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » IIB9: Mapping Node fn:count/fn:foreach
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.