Developer forum

Forum » Integration » DataIntegration Import sales discounts (EcomSalesDiscount)

DataIntegration Import sales discounts (EcomSalesDiscount)

Finn Frost
Reply

Hi all,

I am currently working on a solution/integration where i now need to import sales discounts from an ERP system into Dynamicweb.
It seems to be possible using the DataIntegration module. However, there are some fields that i dont know what to put in or how it's calculated.

A note: I am exporting data from the ERP system, with full control(a simple .NET/C# application), to xml files, ready for DW(DataIntegration) to read.


These fields are:

  • SalesDiscountCustomersAndGroups
    • I believe this should be AccessUserIds and/or AccessUserGroupIds.However, I do not know the DW Id of neighter user nor usergroup. For users, I only know the AccessUserUserName(which is what i have defined a the key, defines "what" a unique user is) and the AccsssUserExternalID. For UserGroups, i only know the name. Can I uses either of these values, to specify a UserGroup and/or User that the sales discount valid/applied for?
    • I took a look in the database, to see what DW enters in that field, for a user and a user group, which was:
      • USR_256,GRP_4209 Where i believe USR_256 is a reference to a user with ID of 256, and GRP_4209, is a reference to the UserGroup with an id of 4209
      • So in my case, for users, would USR_<AccessUserUserName> or USR_<AccsssUserExternalID> OR GRP_<AccessUserGroupGroupName> work?
  • SalesDiscountDateFrom, SalesDiscountDateTo
    • Is a BigInt DataType, how is this calculated/converted from DateTime?

This job would prob. run once a day, so in order to update existing sales discount (instead of deleting all, an reinsert them), i guess i would need to come up with a unique SalesDiscountID ?

Any help regarding importing sales discounts using the DataIntegration module is much appreciated. I would like to avoid deveoping a custom module/extender, in order to do the import, if possible.

I tested the import with a simple xml document i created manually:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<tables>
  <table tableName="EcomSalesDiscounts">
    <item table="EcomSalesDiscounts">
      <column columnName="SalesDiscountName"><![CDATA[-10% for merchants]]></column>
   <column columnName="SalesDiscountDescription"><![CDATA[Imported -10% for merchants]]></column>
      <column columnName="SalesDiscountDiscountType"><![CDATA[1]]></column>
   <column columnName="SalesDiscountCustomersAndGroups"><![CDATA[Merchants]]></column>
   <column columnName="SalesDiscountValuePercentage"><![CDATA[10]]></column>
   <column columnName="SalesDiscountValueType"><![CDATA[Percentage]]></column>
    </item>
  </table>
</tables>

Although, this failed with the message:
Exception: The data types ntext and ntext are incompatible in the equal to operator.
I have attached a txt document with the full error message.

Any help on how to fix the error is very appreciated.

 

A sidenote: The fields "SalesDiscountCustomersAndGroups" and "SalesDiscountParameters" is the DataType "ntext" which microsoft seem to be deprecating in the future(comming version of ms sql server) as stated here: http://technet.microsoft.com/en-us/library/ms187993.aspx

 


Replies

 
Morten Snedker
Reply
This post has been marked as an answer

Hi Finn,

 

Column SalesDiscountCustomersAndGroups is of type ntext. This should be changed to type nvarchar(max). If you have access to the SQL-server you can do so youself, otherwise you may have the Dynamicweb support do it for you.

 

Regards /Snedker

Votes for this answer: 1
 
Finn Frost
Reply

Hi Morten,

Thank you for your reply, i have access to the sql server, so i'll try and change the datatype my self.

 

Any other (DW folks) that can help me out with the other questions i mentioned?
Am I trying to accomplished something that is impossible with dataintegration (Jonas Dam) ?

 
Morten Snedker
Reply

Hi Finn,

 

Both for groups and users you are looking for the column AccessUserID. So you need to back-track from AccessUserUsername no matter if you're talking users or groups. So you need for uniqueness on this column. If you should happen to have duplicate names on groups, you may take a look at column AccessUserParentID to provide certainty.

And you're quite right on your observation on the GRP_ AND USR_ prefixes.

The two date columns are BigInt's (Int64) representing a DateTimeStamp.

As for the SalesDiscountID: if you provide it, it will be used to match and you'd be able to perform both updates and inserts. If you do not provide a SalesDiscountID you keep adding new rows to the table (and probably end up with unwanted discounts). So yes, it is recommended that you provide the ID yourself.

 

Let me know if the above answers your question.

 

Regards /Snedker

 

 
Finn Frost
Reply

Hi Morten,

Thank you for your replies.

You did answer most, if not all, of my questions. I now have the time and knowledge to perform a more real live test.

 

When you create a post(thread) in this forum, aren't you automaticly added to the subscribelist of changes to this thread? - I think i have signed up for a notification when there are changes to this thread, but i haven't received any.

 
Morten Snedker
Reply

Glad I could help! :-)

 

And yes, you should automatically receive a notification when comment to your thread has occured....spam filter?

 

/Snedker

 

You must be logged in to post in the forum