on 09-17-2009 4:56 PM
Hi
I have a requirement where i need to caluclate the number of detail records formed and add it in trailer section...both at target side...
The output will look like this :
<Detail>
<Field></Field>
</Detail>
<Detail>
<Field></Field>
</Detail>
<Detail>
<Field></Field>
</Detail>
<Trailer>
<Count> 3 </Count>
</Trailer>
Basically, In trailer the Count field will contain the number of Detail records.
Can this be achived by a UDF?? Please help!!!
Actually teh detail node formation at target depends on a lot of nodes of source side...using Count I have already done it but due to lot of nodes @ source side it becomes kind of a mesh...
Hence I was trying to figure out a way in which if I can count the number of detail nodes at target side I can remove the present mapping...
Corect me if I am wrong but can't we declare this target detail node as global variable and then use 'Count' function to capture its occurence???
P.S : In XI 3.0 we used to have a tab to declare global variables but here in 7.1 we have Functions tab...could anybody tell me how to declare the variable in 7.1?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check this blog if you are confused on declaring a grapgical variable in PI7.1:
/people/william.li/blog/2008/02/13/sap-pi-71-mapping-enhancements-series-using-graphical-variable
You can search with keywords "Global Variable" in SDN and you will have the ways to declare it in PI7.1
Regards,
Abhishek.
Hi Soumen,
>>Corect me if I am wrong but can't we declare this target detail node as global variable and then use 'Count' function to capture its occurence???
No you can't do that.
I would suggest you to go for one more mapping from target to target MT so that you can count the Details node and put it in trailer. That will be much simpler
Regards
Suraj
Hi,
This is very much possible with global container. You just set a global variable at the Root node.
And at node <Detail> you get this global container and increment it by 1. hence whenever this Detailed node is created it will be incremented by one. At the end for <Trailer> node get this global container value. This will give you the total number of <Detail> node. You need to write UDF to set and get the global container veriable.
Shweta
hi,
There is no need of UDF..
Using the count function will suffice..
Cheers,
Divya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The Detail node seems to be on the target side....so you cannot apply any logic on it.
I suppose you have some node on the source side and depending on the occurence of this node your target Detail node is created.
So check for the occurence of this source node....it will be same as that of the Details node....make a count on this source node and map this count to the Count node.
Regards,
Abhishek.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you can know how many details nodes are being generated while you are at the source message itself, it is possible. You can use counter in between the mapping u use for creating the details node on the right hand side.
VJ
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Das,
Use count function.
Detail(change the context to root node) --> count --> trailercount
Regards,
---Satish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.