Hello,
Can someone point me to the correct usage of KeyMgtGetNextValue() routine. I see in the definition there is a parameter to this routine. How do we define this parameter? Do we have to pass a constant number value as the argument or is there a place to define the variables and pass that as an argument?
Thanks in advance for the help
KeyMgtGetNextValue Usage
Moderators: chulett, rschirm, roy
Hi
KeyMgtGetNextValue() is the special routine which will generate sequential numbers. You need to pass the string as parameter and it will be stored inside SDKSequences universe table. This prameter is unique and you cannot have duplicate name. The string is case sensitive. Each time you use this function along with the parameter it will read from the universe and will increase the value in increment and will output the incremented value.
Whenever you want to reset this then you need to update the value in universe.
Syntax:
UPDATE SDKSequences USING DICT VOC SET F1 = 'New_Value' WHERE @ID = 'Sequence_Name';
Thanks
KeyMgtGetNextValue() is the special routine which will generate sequential numbers. You need to pass the string as parameter and it will be stored inside SDKSequences universe table. This prameter is unique and you cannot have duplicate name. The string is case sensitive. Each time you use this function along with the parameter it will read from the universe and will increase the value in increment and will output the incremented value.
Whenever you want to reset this then you need to update the value in universe.
Syntax:
UPDATE SDKSequences USING DICT VOC SET F1 = 'New_Value' WHERE @ID = 'Sequence_Name';
Thanks
Regards
Siva
Listening to the Learned
"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar
Siva
Listening to the Learned
"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar
Re: KeyMgtGetNextValue Usage
You do not need pass constant, this is usually used for one time loads, fro eaxample you have recordanilkona wrote:Hello,
Can someone point me to the correct usage of KeyMgtGetNextValue() routine. I see in the definition there is a parameter to this routine. How do we define this parameter? Do we have to pass a constant number value as the argument or is there a place to define the variables and pass that as an argument?
Thanks in advance for the help
col1 col2 col3
a 1 A1
b 2 B1
when you use keyMgt... and run your job for first time your output
col1 col2 col3 col4
a 1 A1 1
b 2 B1 2
but by any chance if you have to rerun the job your output will be
col1 col2 col3 col4
a 1 A1 1
b 2 B1 2
a 1 A1 3
b 2 B1 4
which make your records distinct so either you have to reset KEY in SDK every time you run or use @InrowNumber or @OutrowNumber depending on your situation
you can reset your key in SDK if you use KeyMgt.... as Siva said above
RRCHINTALA
As an FYI, these SDK routines are documented, some better than others - check out the Short and Long Descriptions in their properties. For example, this routine says:
Some caveats: It does require a constant value be passed to it if you are expecting a useful series of numbers to come back from it. Each parameter value passed in becomes a key to the hash it uses and starts a new series of numbers if that key doesn't already exist, otherwise you get the next number in sequence for that key. Lastly, because it uses COMMON storage, it is not recommended for use in jobs that take advantage of Row Buffering.
Sequence number generator.
By 'file' it means hash file. You can also read the code to get a better understanding of what it does and how it does it.Routine to generate a sequential number. This routine does not support access to a particular sequence by more than one process concurrently. The routine argument is the name associated with the sequence. The routine uses a file to store the next available number. It reads the number once, then increments and stores the value in common, writing the next value back to file each time.
Some caveats: It does require a constant value be passed to it if you are expecting a useful series of numbers to come back from it. Each parameter value passed in becomes a key to the hash it uses and starts a new series of numbers if that key doesn't already exist, otherwise you get the next number in sequence for that key. Lastly, because it uses COMMON storage, it is not recommended for use in jobs that take advantage of Row Buffering.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers