on 01-02-2015 2:40 PM
Hi,
I am stuck in 1 place in message mapping. I have to Use only the first occurrence of ItemLocation only as detailed below.
Oh I am on PI 7.1.1
My Target structure is a flat structure.
My current mapping attempt is below-
The If condition gives me the correct match with Item Header and Item Location.
The above ID gives me all the 3 occurrences of 3 values from the source side.
Tried multiple mappings (collapse / remove and misc) but nothing is giving me the correct result.
Here copy value 0 always gives me the first itemLocation -> ItemID -> ID
For 1st Header Record, it is ok
But that is not ok for 2nd Header Record.
I have been through the forum but not finding anything that is helping…
Please advice. I am stuck.
Regards,
Archana
Hi Archana,
Can you please show mw your target structure once..
Thanks,
Sreenivas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Right click on your source field i.e. ( ID field under itemlocation) and set the context to Item master.
then collapse context which will take first occurrence from each item location.
Then use split by value to map it to target field.
your mapping should be :
ID (context-> item master) -> collapse context -> split by value -> target field
Having said that, i didn't understand the logic behind index/if then condition. How are you finding the matching Location for the header? is there a field in both the segments to compare?
If you just apply index function on Location and Header nodes then i'm not sure how you can get a matching record. This will always return the first occurrence as true.
If you get a matching location segment as second occurrence, then your mapping shouldn't work. I would suggest you check the logic to find the the matching location segment.
I know my mapping is only half...more work to be done but it is getting there.
but thank you guys
am going to ask more...
what is happening is that there will always be the below structure sequence in the Source-
ItemMaster - 1...unbounded
ItemMasterHeader - cardinality 1
ItemLocation - 0...unbounded
ItemID - 0..unbounded
ID Field - 1
Now there can be more than 1 ItemMaster records with the above sequence
For the Target, It is always a flat structure
All the ItemMaster have to be mapped to the target access in a flat sequence
access 1...unbounded
WarehouseID - 1
ProductGroup - 1
Field3 - 1
Now there are 3 fields that are to be mapped from ItemLocation to the target access and all the 3 fields on target side are mandatory
I am anyways makring the XML validation as active in sender and receievr agreement.
However, the requirement is defined as ALWAYS map the FIRST occurrence of ItemLocation within the ItemMaster record ONLY.
ItemLocation in Source is 0..unbounded
I still have to check if the ItemLocation is not received, then raise an exception.
Can i still use ifExists function?
However, as the XML validation will be activated, the mandatory fields when not mapped with a value during runtime will raise a mapping exception.
Additionally, i also have to check if the itemLocation is received BUT the source fields taht are mapped to the target mandatory fields are empty, then raise an exception and NOT map with default.
i hope the above makes sense.
I am currently also doing various scenario tests at the same time so make sure that the mapping should work in all scenarios and raise an exception only where defined.
Please advice
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
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.