on 07-25-2016 2:29 PM
Hi All,
I have a Idoc to csv file scenario.
In my idoc have a segment E1WXX01(it can occur n number of times) where it contains the fields FLDGRP, FLDNAME and FLDVALUE.
If FLDGRP = "MARA" and FLDNAME = "TRUE" and FLDVAL = "Y" then only that line item should come or else it should not come. Not all the E1WXX01 segment contains exactly these values, it varies so if any of the E1WXX01 segment contains these values then the line item should populate.
My source structure:
Idoc:
EDI_DC40--->E1WPA01(1:1)---->E1WXX01(1:unbounded)
CSV file format:
Data1
Item,3154,1,TRUE,1,0
Item,2674,1,FALSE,1,0
Item,8908,1,TRUE,1,0
so, in my case now only first and third line items should come second should not populate at all. I am unable to use create if function due to context changes. How can I get the target file as expected?
Thanks in Advance.
Just change the context of fields FLDGRP , FLDNAME and FLDVAL to E1WPA01 in your mapping.
Br,
Manoj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raghuraman!
Yes, you're right, it should work. But it's worth mention that if any of FLDGRP, FLDNAME or FLDVAL is missing for E1WXX01 segment than moving these elements to E1WPA01 in some cases might lead to wrong count and order of elements in respective queues.
So, if the FLDGRP, FLDNAME and FLDVAL elements are always obligatory for a E1WXX01 segement we can follow Manoj's above suggestion, otherwise, we might consider using MapWithDefault[]->RemoveContexts for each of these fields with its initial context.
Regards, Evgeniy.
Hi All,
Thanks for all your suggestions.
I applied Evgeniy logic and now I am able to get the line items. But the problem is in the line items whererver the constant values are mapped only those are shown. I have 2 fields where some mapping is there, those are not appearing in the target nodes.
My mapping at the Data_1 Level:
My target nodes created after applying this:
After first field, there is a field called SKU, it is not appearing in the target node although in display queue I can see the values.
Thanks
Hi Manoj,
Thank you very much. It is working as expected. But previously when I applied the same logic, it did not work.
Now I have the final field "seq no" in the target structure. If the line item is more than one than we will put the sequence no according to that. i.e if the line item is 1 then the seq no is 0 and if line item is 2 the seq no is 1.It worked perfectly before applying this Data_1 logic. But now it is generating some random values.
Thanks
Richa,
Using Counter and Index will be bit tricky as we are suppressing node with create if so you can use the GlobalContainer to add the counter value to the field.
Firstly define the int counter =0; in Attributes and Methods
Add the below UDF no input required
GlobalContainer gc = container.getGlobalContainer();
Object o =gc.getParameter("counter");
Integer i=0;
if(o==null)
i = new Integer(0);
else
i = (Integer)o;
i = new Integer(i.intValue() + 1);
gc.setParameter("counter",i);
return i.toString();
Mapping logic just combine the same logic of create IF with the UDF as below.
Hello Richa,
Can you post the queue and context ,might be you can use If else and node functions to achieve the same.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
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.