Company Selection
Is there a way to import data into a particular company if multiple companies are selected using the same excel datasource. Ideally, I would like to use one MAP and have a identifer in the datsource to which company the data should be imported?
Answers
Best Answer
Hi Mick,
The way to import the data to the particular company from the Excel sheet is to create a script to determine which records go to which companies.
Open your map and destination, then click on the companies button. In the Companies window, click on the “Define” option which will open the “Map Destination Definition” where you can script the definition of the destination company based on the particular column from the Excel sheet.
Make sure that you uncheck any columns in the companies window or data will go to the selected companies as well as the company defined by the script.
For example: if you have a column in your spreadsheet (COMPANY) that holds the company id the following script could be used.
C#
return _COMPANY;
VB
return _COMPANY
If more than one field determines the company then use an if or switch statement to return the correct code.
C#
If(_FIELD1 == “value1” && _FIELD2 == “value2”)
return “TWO”;
return “ONE”;
VB
If _FIELD1 = "value1" AndAlso _FIELD2 = "value2" Then
Return "TWO"
Else
Return “ONE”
End If
The way to import the data to the particular company from the Excel sheet is to create a script to determine which records go to which companies.
Open your map and destination, then click on the companies button. In the Companies window, click on the “Define” option which will open the “Map Destination Definition” where you can script the definition of the destination company based on the particular column from the Excel sheet.
Make sure that you uncheck any columns in the companies window or data will go to the selected companies as well as the company defined by the script.
For example: if you have a column in your spreadsheet (COMPANY) that holds the company id the following script could be used.
C#
return _COMPANY;
VB
return _COMPANY
If more than one field determines the company then use an if or switch statement to return the correct code.
C#
If(_FIELD1 == “value1” && _FIELD2 == “value2”)
return “TWO”;
return “ONE”;
VB
If _FIELD1 = "value1" AndAlso _FIELD2 = "value2" Then
Return "TWO"
Else
Return “ONE”
End If
Ken, I was wondering if that is where it got selected, thanks very much for confirming and providing the required code, will test this out shortly. Regards, Mick
did this ever worked I am using the return _CompanyID or Return “TEST1” and I am getting error message:
Error Updating SY01500 table wit next note index Note Identifier Parameters: tasmGetNetNoteIndex
unable to obtain next note index. Note identifier parameters: taCreateUpdateBatchHeaderRct
unable to update/create the batch Number node identifier parameters: taSopHdrIvcInsert…
Nevermind.. I found out what the issue was… I am using a difference SQL Instance for the SmartConnect 2013 and the destination instance. This is just I can have SmartConnect 10 and SmartConnect 2013 co-existing.
i have done that and it was very helpfull and work properly by what about configure the voucher number as gp rolling column required to choose specific company can you help please