Hello,
Sorry for my bad english...I want to generate a file CSV for sorting and grouping data in only one file csv according to the example below :
Input CSV File
***************************************
NUMCDE;REFERENCE;QTY
CDE111111; AAAAAAAAAAAAA;1
CDE111111; BBBBBBBBBBBBB;2
CDE111111; CCCCCCCCCCCCC;3
CDE222222; DDDDDDDDDDDDD;1
CDE222222; EEEEEEEEEEEEE;2
CDE222222; FFFFFFFFFFFFFFF;3
CDE333333; GGGGGGGGGGGG;1
CDE333333; HHHHHHHHHHHHHH;2
CDE333333; KKKKKKKKKKKKKK;3
Outpout CSV File
*****************************************
NUMCDE; QTY & REFERENCE
CDE111111; 1 x AAAAAAAAAAAAA 2 x BBBBBBBBBBBBB 3 x CCCCCCCCCCCCC
CDE222222; 1 x DDDDDDDDDDDDD 2 x EEEEEEEEEEEEE 3 x FFFFFFFFFFFFFF
CDE333333; 1 x GGGGGGGGGGGG 2 x HHHHHHHHHHHHH 3 x KKKKKKKKKKKKK
*********************************************
I took as a starting point the following script. but I do not find the solution but I do not find the solution for sorting, grouping and to write the final file…
Const ForReading = 1
'Create the file system object
Set oFSO = CreateObject("Scripting.FileSystemObject")
'open the data file
Set oTextStream = oFSO.OpenTextFile("I:\VP5\test_array1.csv", ForReading)
'make an array from the data file
CSVArray = Split(oTextStream.ReadAll, vbNewLine)
'close the data file
oTextStream.Close
'Loop through the records
For Each ArticleLine In CSVArray
'Now looping through each agent line
ArticleArray = Split(ArticleLine,";")
NUMC = ArticleArray(0)
CODEART = ArticleArray(1)
DESIGN = ArticleArray(2)
NOMFRN = ArticleArray(3)
QTEART = ArticleArray(4)
'Bufferise dernier n° CDE - Désignation et quantité
PREC_NUMC = ArticleArray(0)
PREC_DESIGN= ArticleArray(2)
PREC_QTE= ArticleArray(4)
Next
Thank you in advance for your assistance
Sorry for my bad english...I want to generate a file CSV for sorting and grouping data in only one file csv according to the example below :
Input CSV File
***************************************
NUMCDE;REFERENCE;QTY
CDE111111; AAAAAAAAAAAAA;1
CDE111111; BBBBBBBBBBBBB;2
CDE111111; CCCCCCCCCCCCC;3
CDE222222; DDDDDDDDDDDDD;1
CDE222222; EEEEEEEEEEEEE;2
CDE222222; FFFFFFFFFFFFFFF;3
CDE333333; GGGGGGGGGGGG;1
CDE333333; HHHHHHHHHHHHHH;2
CDE333333; KKKKKKKKKKKKKK;3
Outpout CSV File
*****************************************
NUMCDE; QTY & REFERENCE
CDE111111; 1 x AAAAAAAAAAAAA 2 x BBBBBBBBBBBBB 3 x CCCCCCCCCCCCC
CDE222222; 1 x DDDDDDDDDDDDD 2 x EEEEEEEEEEEEE 3 x FFFFFFFFFFFFFF
CDE333333; 1 x GGGGGGGGGGGG 2 x HHHHHHHHHHHHH 3 x KKKKKKKKKKKKK
*********************************************
I took as a starting point the following script. but I do not find the solution but I do not find the solution for sorting, grouping and to write the final file…
Const ForReading = 1
'Create the file system object
Set oFSO = CreateObject("Scripting.FileSystemObject")
'open the data file
Set oTextStream = oFSO.OpenTextFile("I:\VP5\test_array1.csv", ForReading)
'make an array from the data file
CSVArray = Split(oTextStream.ReadAll, vbNewLine)
'close the data file
oTextStream.Close
'Loop through the records
For Each ArticleLine In CSVArray
'Now looping through each agent line
ArticleArray = Split(ArticleLine,";")
NUMC = ArticleArray(0)
CODEART = ArticleArray(1)
DESIGN = ArticleArray(2)
NOMFRN = ArticleArray(3)
QTEART = ArticleArray(4)
'Bufferise dernier n° CDE - Désignation et quantité
PREC_NUMC = ArticleArray(0)
PREC_DESIGN= ArticleArray(2)
PREC_QTE= ArticleArray(4)
Next
Thank you in advance for your assistance