cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate primary key column for each row in a document

rbikash7758
New Contributor III

Hi All ,

I wanted to load from csv to anaplan and need to generate a id column using sequence
number .

lets see if i have 100 rows in one document so , anaplan id column should be loaded through snaplogic with id as CS1,CS2,CS3 and so on and next time in the arrival of new document it should be incremented from cs101 onwards and so on .

I searched through snaplogic and its showing as document wise we can add sequence number which is not my requirement .

Thanks ,
Bikash

1 REPLY 1

rbikash7758
New Contributor III

Hi Guys ,

Attached the Pipeline .Please refer in case needed .

I used below process to meet my above requirements .I am using snap.out.totalCount expression to generate the sequence .

First I create 2 table’s in postgres .

This table keeps the track of max of sequence number .
create table Diretory_uniqueid
(
ID integer
);
insert into Diretory_uniqueid values(0);

CREATE TABLE DIRECTORY
(
Prim_Key varchar(200),
Department varchar(200),
Dept_ID integer,
Email varchar(200),
Extensionn varchar(20),
Location varchar(200),
Name varchar(200),
Title varchar(200)
);

this is my main table where prim_key is the key auto increment column .

Below is the snapshot of the Pipeline .
image

image
image
image Sequence Generator Pipeline_2019_04_02.slp (19.8 KB)

image
image
After load sequence track table shows below :
image
main table records :
image