Over vs Runs -- same sequence number for each group

I am having input column as runs with values
3
2
4
6
0
1
0
3
2
6
0
0
4
1
1
2
3
In output I want over number on Over column and corresponding runs on Runs column
Expected o/p is:-
Over Runs
1 2
1 4
1 6
1 3
1 0
1 1
2 0
2 3
2 2
2 6
2 0
2 0
3 4
3 1
3 1
3 2
3 3

Showing Answers 1 - 3 of 3 Answers

Amaan Ansari

  • Feb 5th, 2021
 

There are multiple ways to do it.
Simplest way is to use a reformat

Use a reformat

In the input
Record
Decimal (‘|’) Runs;
End

In the output dml
Runs
Over


In the transform 

Out.run :: in.run
Out.over :: decimal_rounddown((next_in_sequence/6) + 1,0)

  Was this answer useful?  Yes

Kiran

  • Mar 1st, 2021
 

Hi Amaan, This is the simplest and easy solution with one fault. For the first over, it shows only 5 balls as at 6th place, from roundown we are getting 6/6 as 1 and adding 1 to that makes it 2, so second over starts from it. To resolve this, need to subtract 1 from next_in_sequence.

  Was this answer useful?  Yes

shivank b

  • Apr 4th, 2021
 

We can make slight change in aamans solution.
Out.run :: in.run
Out.over :1: if (next_in_sequence()%6 != 0) decimal_rounddown((next_in_sequence/6) + 1,0)
Out.over :: (next_in_sequence/6)

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions