UDA
Enthusiast

## A bit of mathermatics

Hi.

I have a formula to calculate a unique transaction sequence number that works as follows:

transaction sequence(TS) * 100 + record sequence(RS)

So take two examples:
118(TS) * 100 + 103(RS) = 11903
99(TS) * 100 + 50 = 9950

From the results I need to be able to get back to determine the original TS and RS.
The solution has to work for both examples above.
So in the case of 11903 I need to get back to 118 and 103 and in the case of 9950 I need to get to 99 and 50.

Any help thouroughly appreciated.
3 REPLIES 3
Enthusiast

## Re: A bit of mathermatics

I don't think, it would be possible because no. of digits in RS is varying and the key point is it could be more then 2
Enthusiast

## Re: A bit of mathermatics

Thanks Pawan - exactly what I was thinking. Oh well it wasn't critical anyway, I have an alternative just not a mathematical one.
Enthusiast

## Re: A bit of mathermatics

FYI I think this algorithm will work apart from the first examples where the TS and RQ cross over which gives me another option:

seq_id / 100 as TS;
seq_id mod 100 as RS;