Skip to content
+1-888-319-3663

COMMUNITY FORUM

Keys and Groups

Charles asked 5 years ago
A client has a map to import invoices. they have a need to create a new invoice per line item for customer numbers that end with 99. As far as I know, they need to create a new map for these customers. But, I thought I’d ask just in case somebody has an idea if there’s any way to script it.
Answers
Lorren Zemke Staff answered 5 years ago
Charles,
Yes, you would have to create a new map because you would have to set your key fields and Group By fields on the header to the right values based on the criteria. We can’t have a key field or group by change based on specific values.
 
Lorren
Patrick Roth Staff answered 5 years ago
Charles,
Well, you could maybe do it but the result would be pretty ugly.
You could make a task – perhaps a Line Restriction task on the add line item.
Check the customer and if ends with 99, then use VB/C# to create an ADO connection and you could call the eConnect procs directly for the line & the header.
Then you would use a “before document” task to cancel sending this document to eConnct since the lines created it for you already.
So that would work – but you wouldn’t see the data showing up as integrated the same as teh rest of the data since you slipped it in behind the scenes.
Otherwise, the only other solution is that you need another column in your source file.
So perhaps you have data like this:
Cust, Item, Indicator
AAAA, Item1, 0
AAAA, Item2, 0
BB99, Item1, 1
BB99, Item2, 2
BB99, Item3, 3
CCCC, Item 1, 0
CCCC, Item 2, 0
So then make your key/group on Customer & Indicator
For Customers AAAA & CCCC, these will all match and so get grouped together.
But for the BB99 customer, since the Indicator is different for each line, then you’d get one document per line item.
You could also use two maps as you were thinking.  But in the end since you would need a unique field per line (so that the keys would group to one line per document), you would still need some kind of Indicator field since just using Customer would again group it for the whole document.  Because of that, could as well just use one map as outlined above.

patrick
 
 
 

If you would like to submit an answer or comment, please sign in to the eOne portal.