|
|
|
Supreme Being
      
Group: Forum Members
Last Login: 2 days ago @ 11:38:39 AM
Posts: 111,
Visits: 99
|
|
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.
|
|
|
|
|
Forum Member
      
Group: Forum Members
Last Login: 2 days ago @ 7:45:03 AM
Posts: 39,
Visits: 169
|
|
|
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
|
|
|
|
|
Supreme Being
      
Group: Forum Members
Last Login: 2 days ago @ 11:38:39 AM
Posts: 111,
Visits: 99
|
|
|
Thanks Pawan - exactly what I was thinking. Oh well it wasn't critical anyway, I have an alternative just not a mathematical one.
|
|
|
|
|
Supreme Being
      
Group: Forum Members
Last Login: 2 days ago @ 11:38:39 AM
Posts: 111,
Visits: 99
|
|
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;
|
|
|
|