Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Because this script just a record breaking quantities of parts?
tmp:
load * inline[
DATA, PARCELAS
'11/10/2011',20
'21/10/2011',7
];
LET X = peek('PARCELAS');
LET Z = peek('DATA');
FOR i = 1 to $(x)
load * inline
[
DATA, PARCELAS
$(z),$(i)
];
next i
did you mean this?
tmp:
load * inline [
DATA, PARCELAS
'11/10/2011',20
'21/10/2011',7
];
Counts:
LOAD Count(PARCELAS) as Y
Resident tmp;
LET y = Peek('Y', 0) - 1;
DROP Table Counts;
for k = 0 to $(y)
LET x = peek('PARCELAS', $(k));
LET z = peek('DATA', $(k));
FOR i = 1 to $(x)
load * inline [
DATA, PARCELAS
$(z),$(i)
];
next i
NEXT k
But be aware about duplication of two first records.
Can anyone help?
What do you mean with break?
Which is your desired result? Maybe if you are more specific, we can help you easily. 😉
This is what you get right now. Right?
DATA | PARCELAS |
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
40827 | 20 |
40837 | 7 |
Exactly.
This is what I have now.
You can observe that the value did not break 20.
My table is comprised of several records with different field plots.
In my example, I posted only two record, just one more record breaking obeyed.
Sorry Washington, I still don't get you when you say "the value did not break 20" ¿?
Could you put an example of your desired result, like I showed you my final table result before?
Thank you.
did you mean this?
tmp:
load * inline [
DATA, PARCELAS
'11/10/2011',20
'21/10/2011',7
];
Counts:
LOAD Count(PARCELAS) as Y
Resident tmp;
LET y = Peek('Y', 0) - 1;
DROP Table Counts;
for k = 0 to $(y)
LET x = peek('PARCELAS', $(k));
LET z = peek('DATA', $(k));
FOR i = 1 to $(x)
load * inline [
DATA, PARCELAS
$(z),$(i)
];
next i
NEXT k
But be aware about duplication of two first records.
Beauty, solved my problem.
Thanks.
Hi,
I change the script for not duplicate.
Datas:
load * inline [
DATA, PARCELAS
'11/10/2011',20
'21/10/2011',7
];
FOR k = 0 TO (NoOfRows('Datas')-1)
LET data = peek('DATA', $(k));
LET parcela = peek('PARCELAS', $(k));
FOR i = 1 to ($(parcela)-1)
load
Date('$(data)') as DATA,
'$(i)' as PARCELAS
Autogenerate(1);
NEXT i
NEXT k
Fernando,
Because in your example the second record did not break like the original?
Washington,
I did a test here and it worked properly.
Following is the table with the data.
DATA | PARCELAS | count(DATA&PARCELAS) |
---|---|---|
27 | ||
11/10/2011 | 1 | 1 |
11/10/2011 | 2 | 1 |
11/10/2011 | 3 | 1 |
11/10/2011 | 4 | 1 |
11/10/2011 | 5 | 1 |
11/10/2011 | 6 | 1 |
11/10/2011 | 7 | 1 |
11/10/2011 | 8 | 1 |
11/10/2011 | 9 | 1 |
11/10/2011 | 10 | 1 |
11/10/2011 | 11 | 1 |
11/10/2011 | 12 | 1 |
11/10/2011 | 13 | 1 |
11/10/2011 | 14 | 1 |
11/10/2011 | 15 | 1 |
11/10/2011 | 16 | 1 |
11/10/2011 | 17 | 1 |
11/10/2011 | 18 | 1 |
11/10/2011 | 19 | 1 |
11/10/2011 | 20 | 1 |
21/10/2011 | 1 | 1 |
21/10/2011 | 2 | 1 |
21/10/2011 | 3 | 1 |
21/10/2011 | 4 | 1 |
21/10/2011 | 5 | 1 |
21/10/2011 | 6 | 1 |
21/10/2011 | 7 | 1 |