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
Fernando,
I'm using the example that you have not left over is breaking the second record:
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
OK,
I understand the problem.
change the command autogenerante.
load
Date('$(data)','DD/MM/YYYY') as DATA,
'$(i)' as PARCELAS
Autogenerate(1);
OR
change the system variables to Portuguese
SET ThousandSep='.';
SET DecimalSep=',';
SET MoneyThousandSep='.';
SET MoneyDecimalSep=',';
SET MoneyFormat='R$ #.##0,00;-R$ #.##0,00';
SET TimeFormat='hh:mm:ss';
SET DateFormat='DD/MM/YYYY';
SET TimestampFormat='DD/MM/YYYY hh:mm:ss[.fff]';
SET MonthNames='jan;fev;mar;abr;mai;jun;jul;ago;set;out;nov;dez';
SET DayNames='seg;ter;qua;qui;sex;sáb;dom';
Fernando,
Solved the problem.
Now I'm using this script to a QVD.
Only one field that is not working. It is the field 'Valor_Compra'.
If you can help spin grateful again.
Thanks.
Datas:
LOAD
COD_FORNECEDOR
,
Valor_Compra
,
Parcelas
,
Prazos
FROM
C:\Importa\tabela.qvd(
qvd);
FOR
LET
LET
LET
LET
LET
FOR
load
Date
('$(data)','DD/MM/YYYY')+('$(Prazo)'*'$(i)') as Data,
'$(i)'
as Parcelas,
'$(fornecedor)'
as COD_FORNECEDOR,
'$(V_Compra)'
as Valor_Compra,
'$(Prazo)'
as Prazos
Autogenerate
(1);
NEXT
iNEXT
k i = 1 to ($(parcela)-1) Prazo = peek('Prazos', $(k)); V_Compra = peek('Valor_Compra', $(k)); fornecedor = peek('COD_FORNECEDOR', $(k)); parcela = peek('Parcelas', $(k)); data = peek('Data', $(k)); k = 0 TO (NoOfRows('Datas')-1) date(Data,'DD/MM/YYYY') AS Data,Washington,
I can't understand the code you put in.
post the QVW fil.
Fernando,
Note that the field 'Valor_compra' is for each record with two values.
Also, I need the field 'Plots' come with the original, without breaking. So I have two fields 'Plots', breaking and without breaking.
I think with these settings I finalize the application.
Thank you.
You can try this code.
qualify *;
unqualify COD_FORNECEDOR;
Datas:
LOAD date(Data,'DD/MM/YYYY') AS Data,
COD_FORNECEDOR,
//Round( Valor_Compra) as Valor_Compra,
Valor_Compra,
Parcelas,
Prazos
FROM tabela.qvd(qvd);
Unqualify *;
FOR k = 0 TO (NoOfRows('Datas')-1)
LET data = peek('Datas.Data', $(k));
LET parcela = peek('Datas.Parcelas', $(k));
LET fornecedor = peek('COD_FORNECEDOR', $(k));
LET V_Compra = peek('Datas.Valor_Compra', $(k));
LET Prazo = peek('Datas.Prazos', $(k));
LET vValorParcela = Num('$(V_Compra)')/Num('$(parcela)');
FOR i = 0 to ($(parcela)-1)
Parcelas:
LOAD
Date(Date('$(data)','DD/MM/YYYY')+('$(Prazo)'*'$(i)'),'DD/MM/YYYY') as Data_Vencimento,
'$(i)'+1 as Parcelas,
'$(parcela)' as Total_Parcelas,
'$(fornecedor)' as COD_FORNECEDOR,
'$(V_Compra)' as Valor_Compra,
'$(Prazo)' as Prazos,
'$(vValorParcela)' as Valor_Parcela
AUTOGENERATE(1);
NEXT i
STORE Parcelas INTO TMP_Parcelas_$(fornecedor).qvd;
DROP TABLE Parcelas;
NEXT k
Parcelas:
LOAD * FROM TMP_Parcelas_*.qvd (qvd);
Fernando,
Now it worked.
Thank you.
Hi,
You ca try this, in autogenerate.
Load
Date('$(data)','DD/MM/YYYY')+('$(Prazo)'*'$(i)') as Data,
'$(i)' as Parcelas,
'$(fornecedor)' as COD_FORNECEDOR,
Round('$(V_Compra)',0,001) as Valor_Compra,
'$(Prazo)' as Prazos
Autogenerate(1);