Developer forum

Forum » Development » Custom script

Reply
Hey

I'm building this custom-script to be able to import products and groups from an external xml-file.

First of all I'm looping my XML-file for productgroups. For each group I check whether the group exists or not. If not, I create the group. Now this is the problem.

All the groups ind the ProductGroups table has a column called GroupID. This is NOT autoincrement - so how do I figure out, what GroupID to insert?

Normally I'd fetch the 'newest' row like GROUP13 and make my GROUP14 out of it - just ordering by GroupID. But in SQL GROUP10 is sorted before GROUP9.

Because of this, this doesn't work:

select top 1 GroupID from EcomGroups

Any suggestions?

/ Bo Dudek

Replies

 
Reply

Hej Bo


 


You can use our API. By accessing the NumberGenerator you will get the next Group id accordding to the database.


 


Please use :


eCommerce.Common.NumberGenerator.GetNumber("GROUP")

 

You must be logged in to post in the forum