on 04-05-2012 6:58 PM
All,
i have this requirement, grouping and producing one subnode if it has same data in it.
My data is
above is the subnode data: is with 0:n occurence
the 1st set is with 1st occurence of parent node, 2nd is 2nd occurence of parent node so forth 4 nodes.
I want the ouput as:
1 occurence: NPWNH, NSTRA, WSTRV (3 subnodes to be created)
2 occurence: CSTRS (1 subnode to be created)
3 occurence : NPWNH, NSTRPS, IPWH, NPRLP, NTROWF (5 subnodes to be created)
4 occurence: CSTRS (1 subnode to be created)
This is not working:
Thank you.
Prema Boodi
Hi,
This can be achieved with a simple UDF (assuming input is your input parameters list of type string):
List list = Collections.synchronizedList(new ArrayList());
for (String s : input){
if (!list.contains(s)) list.add(s);
}
for (int i = 0; i < list.size(); i++) result.addValue(list.get(i));
Then just use: source -> UDF -> target. Most important thing: set the Execution Type of the UDF to "All Values of Context".
Hope this helps,
Greg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks greg.. this helped me to create those nodes.. i want to mark this answered.. but i have one more rather many more query realted to this..
my requirement now is
INPUT:
buildingGroup1
leasedeatil
Building ID= NPWNH
buildingGroup2
leasedeatil
Building ID= NPWNH
---------------------------------------
OUPUT should be
buildingGroup
leasedeatil1
Building ID= NPWNH
leasedeatil2
Building ID= NPWNH
in the below image I'm able to create BuildingGroup if the values(building ID) inside the leasedetails are same . now i want to create as many leasedetails within one buildinggroup if they have same builingID..
Hi,
I hope I understood the requirement correctly. I believe here is how you should build the mapping rule for LeaseDetail node:
BuildingGroup -> sortByKey(BuildingID) -> splitByValue(Value Change) -> LeaseDetail
Field -> sortByKey(BuildingID) -> splitByValue(Each Value) -> Field
The rule for "Field" should be applied to each field under LeaseDetail node that you want to map from source to target.
In addition to that, make a small change to the mapping for the initial field. Instead of: BuildingID -> UDF -> target, use BuildingID -> sort -> UDF -> target. So sort function is what you need to add there to have it working fine all together.
Hope this helps,
Greg
Dear Prema
Before sort have a remove context also.
Regards
Monika
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ankit Soni, solasu bhavanisankar,
I believe none of your suggestions will work as required. As Prema Boodi said, it is required to have 4 separate contexts, each of them having only unique values. I think this is only possible with a UDF, like the one I provided.
Regards,
Greg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
y try below one:
field -> remove context -> sort -> splitByVAlue(Value change)-> collapse ontext -> Target field
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I guess you should remove Split by value(each value) after collapse context and instead use remove context there if you want all the subnodes together or don't use anything after collapse context. Directly map Collapse context to target node. It should work as per your requirement.
Hope this helps,
Ankit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.