I'm new in code so sorry if may question seems dummy
so I loop on csv datas to build an xml
my issue is that i can only pu 5000 files max in an xml and i need to put more than an million? So i'll to make multiple xml with 5000 files in each The first part of my code is done. Now i need to create a counter who would say in my first "for each" loop that as soon as i've reached 5000 lines (and so 5000 documents) i need to return to the beginnig of my first treatment I can't find a way to produce my multiple xml
do/while do/until and the way to produce it
Here is an example of my csv
UCB63_DATENUM;U6618_FILENAME;UF6E8_CANAL;U65B8_IDRP
7/8/19 22:27;457E6659_ZN_LIQRLVPR_A_V_ML.pdf;ML;1367091
9/11/19 23:03;49453878_ZN_LIQRLVPR_A_V_ML.pdf;ML;106440
9/24/19 21:04;497E585B_ZN_LIQRLVPR_A_V_CS.pdf;CS;1536658
2/12/20 22:12;58453B75_ZN_LIQRLVPR_A_V_ML.pdf;ML;1406091
So i thought i could count the line of the first column and as soon as i reach 5000 I call my first loop
If you need further information just ask, i've got no idea how to do
Ok so i will put you the whole code
$FREQUENCE_DECOMPTE = 'Index Nom="FREQUENCE_DECOMPTE" Valeur="MENS"'
$LIBELLE_ORGANISME = 'Index Nom="LIBELLE_ORGANISME" Valeur="HUMANIS CCN OG"'
$MONTANT_TOTAL = 'Index Nom="MONTANT_TOTAL" Valeur="0"'
$POLE = 'Index Nom="POLE" Valeur="1ADP"'
$CODE_ORGANISME = 'Index Nom="CODE_ORGANISME" Valeur="1ADP"'
$RecupDateFinTraitement = Get-Date
$2ndDate = $recupdatefintraitement.AddDays(30)
$liste = Import-Csv -path C:\Temp\test.csv -Delimiter ';'
Import-Csv -path C:\Temp\test.csv -Delimiter ';'
$boucle = foreach ($list in $liste)
{
$list.U6618_FILENAME
$FREQUENCE_DECOMPTE
$LIBELLE_ORGANISME
$MONTANT_TOTAL
$list.UCB63_DATENUM
$POLE
$CODE_ORGANISME
$list.U6618_FILENAME
$list.U65B8_IDRP
$RecupDateFinTraitement.ToString('dd/MM/yyyy')
$2ndDate.ToString('dd/MM/yyyy')
$ALERTEMAIL.UF6E8_CANAL
$fin = $list.UF6E8_CANAL -match "ML"
if ($list.UF6E8_CANAL -match "ML"){1}
else {0}
**## Compteur
$Compte = Get-Content C:\Temp\test.csv | Measure-Object -Line
$compte.lines
if ($Compte.Lines -gt 2)
{
do{$boucle} until ($Compte -gt 5)
}**
}
$boucle | Out-File -FilePath C:\Temp\test2.txt
I don't think explainig the xml would help i just want to lool inside the first loop in order to relaunche the first loop called $boucle if i reach 5000 documents in the first output file (or maybe easier as soon as i reach the 5000th line of the csv) I still have work on the shape of the xml as you see by the name of the output file
Regards