Page 1 of 1

KeyMgtGetNextValueConcurrent

Posted: Tue Aug 17, 2010 3:01 pm
by dsuser91
How can we generate same value in col2 for one family of records.

the current job is using KeyMgtGetNextValueConcurrent to generate col2

col1 col2
456318#16#1 6578
456318#16#2 6580
456318#16#3 6582


col1 col2
784654#19#1 6598
784654#19#2 6600
784654#19#3 6602

Any idea

Posted: Tue Aug 17, 2010 3:48 pm
by arunkumarmm
Sort your input records before the transformer and inside the transformer

1. svOld: svNew
2. svNew: <KeyColumn>
3. svCol2: If svOld <> svNew Then svCol2 + 1 Else svCol2

Map this svCol2 to your Col2

Posted: Wed Aug 18, 2010 10:34 am
by dsuser91

Code: Select all




I am generating a sequential number by using KeyMgtGetNextValueConcurrent

for example

col1 		     col2 
456318#16#1 	6578  
456318#16#2 	6580 
456318#16#3 	6582
784654#19#1 	6584 
784654#19#2 	6586 
784654#19#3 	6588
814544#20#3 	6590
826545#21#3 	6592
835646#22#3 	6594

I want the same sequential number to be assigned for a group of records( i am grouping based on first 2 positions in col1)

col1 		     col2 
456318#16#1 	6578  
456318#16#2 	6578 
456318#16#3 	6578

784654#19#1 	6580
784654#19#2 	6580 
784654#19#3 	6580

814544#20#3 	6590

826545#21#3 	6592

835646#22#3 	6594



Any idea
[/code]

Posted: Wed Aug 18, 2010 11:28 am
by chulett
I have no idea what you are trying to add to this conversation in your post, can you try again please? :?

Posted: Wed Aug 18, 2010 1:37 pm
by dsuser91
chulett wrote:I have no idea what you are trying to add to this conversation in your post, can you try again please? :?
I made a change to my pervious posting

Posted: Wed Aug 18, 2010 2:41 pm
by arunpramanik
split your output to aggregator

Code: Select all


input ----- xfm ---------seqfile
             |------- srt ----- aggregator ---- xfm(use keymgmy) ---- hashfile
then lookup seq file with hash file

Posted: Thu Aug 19, 2010 1:34 am
by arunpramanik
OR
you can use the same as mentioned,
arunkumarmm wrote:Sort your input records before the transformer and inside the transformer

1. svOld: svNew
2. svNew: <KeyColumn>
3. svCol2: If svOld <> svNew Then svCol2 + 1 Else svCol2

Map this svCol2 to your Col2
And the point 3 needs to be changed to something like

Code: Select all

3. svCol2: If svOld <> svNew Then KeyMgtGetNextValueConcurrent Else svCol2

Posted: Thu Aug 19, 2010 1:20 pm
by adams06
I did a modification to stagevar

If lkp.NOTFOUND and svOld <> svNew Then KeyMgtGetNextValueConcurrent Else lkp.ID

I am assiging value for the first record olny, because the the next 2 records fall under the svOld = svNew condition

How can i handle this?

Code: Select all

col1           col2
784654#19#1    6580 
784654#19#2    
784654#19#3  
Thanks

(no clue why the entire post was wrapped in code tags so I 'corrected' it - Moderator)

Posted: Thu Aug 19, 2010 1:52 pm
by kumar_s
Little tweak would do

Sort the data based on the key column.

Pass to Transformer.

Default the stage variables to emptly string
svNew = ''
svOld = ''
svSerialNp = 0

Code: Select all

1. svNew: Col1[0,Index(Col1,'#',2)]
2. svSerialNo: If svNew = svOld Then svSerialNo Else KeyMgtGetNextValueConcurrent
3.  svOld = svNew

Posted: Thu Aug 19, 2010 2:06 pm
by adams06
do you want me to set intial value to null

Posted: Thu Aug 19, 2010 2:08 pm
by kumar_s
You can give two single qoutes. As ''.

Posted: Fri Aug 20, 2010 7:51 am
by dsuser91
kumar_s wrote:You can give two single qoutes. As ''. ...
I did default stage variable to svNew = '' svOld = ''. but still no change.

In your early post you did mentioned about svSerialNp = 0, do want me to create a new stage variable. i was not able read the entire message

Thanks

Posted: Wed Aug 25, 2010 8:58 am
by kumar_s
I just removed the mask, just check if that helps.
Inorder to avail the full feature, you just have to enroll into Premium memership!!