The problem is, if i have two or more tickets, like above, it only shows me the data of the last one. In this case TICK012346. Dosent matter if i do it in powershell or orchestrator.
The script supplied has a space between the variable and the field, I’m assuming that’s just a formatting issue.
Also, When I try to do this:
$ticket=import-csv *.csv -delimiter “;” I get this:
Cannot perform operation because the path resolved to more than one file. This command cannot operate on
multiple files
You’ll probably want to do something along the lines of
$files=(get-childitem *.csv)
$ticket=foreach ($f in $files){import-csv $f -delimiter ";"}
" i have multiple .csv files", should you not be appending as you loop through the CSV files ??
$Results = @()
ForEach ($TICK in $ticket){
$Results += [PSCustomObject] @{
ticket_id = $($TICK .Ticket_ID)
date_submitted = $($TICK .Date_Submitted)
company_id = $($TICK .Company_ID)
company_name = $($TICK .Company_Name)
}
# this should contain data from all CSVs passed to it
$Results
[quote quote=161535]No, I need the individual variables.
Like ticket_id and company_id, to work with them later in sql.[/quote]
Do you want every ticket ID number to be contained in the single ticket_id variable, or do you want each ticket ID number to be contained in a separate ticket_id variable so that they can be referenced individually?