Developer forum

Forum » CMS - Standard features » Best practices adding Items from External source

Best practices adding Items from External source

Tom-Erik Paulsen
Reply

Hi, I was wondering what best practice is on handling Items from other sources. 

Lets say I have made an itemType ( table: ItemType_companies )
And lets say I have made a script that checks an external source ( xml or json ) for new entries. And I want to add those entries to my ItemType_Companies table.

What I have noticed, is that when creating an ItemType, it makes all the fields TEXT even the ID field and not as Integer Primary key with autoincrement.

"dbo     ItemType_Test     Id     -9     nvarchar     255     510"

If I then add items to the database, I have to give the field an unique ID to be able to extract it from the database. 

Question one comes down to, whats best practice to maintain a nice and incremental structure on the ID field?

Question two:
Why do you make an ID field varchar when its only used by the system?

 


Replies

 
Nicolai Høeg Pedersen
Reply

Hi Tom-Erik

There is no 'best practice' around that. You can use whatever ID you want. The reason it is text strings and not auto ids, is that you have much better control when importing.

BR Nicolai

 

You must be logged in to post in the forum