Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi there,
I have a table like the following (generalised data):
Positions:
Position | String |
1 | a |
2 | b |
3 | c |
4 | d |
5 | e |
6 | f |
7 | g |
8 | a |
9 | h |
10 |
d |
With an extract of relevant pairs as follows (assume that a and d are pairs that indicate the start and end of relevant data):
Pairs:
Position | String | StringCount |
1 | a | 1 |
4 | d | 1 |
8 | a | 2 |
10 | d | 2 |
These tables continue for multiple rows, and there are multiple instances of "a" and "d" with data in between.
The positions and counts of a and d can change depending on the source data.
I wish to load the above table but include the data that appears between the pairs, i.e:
Pairs:
Position | String |
1 | a |
2 | b |
3 | c |
4 | d |
8 | a |
9 | f |
10 |
d |
What is the easiest way to solve this? I figure I might be able to use a loop that relies on the StringCount, but wondering what ideas you have.
Cheers,
Prog
How I solved this using a loop:
Let vPairAmount = Peek('StringCount',-1,'Pairs');
For i = 1 to $(vPairAmount)
Concatenate (Pairs)
Load
Position,
String
Resident Positions
Where Position > Peek('Position',$(i)+$(i)-2,'Pairs') and Position < Peek('Position',$(i)+$(i)-1,'Pairs');
Next i;