몇 가지 다른 파일로 해부해야 할 몇백 개의 레코드가있는 .csv 파일이 있습니다. 객체의 배열을 취하고 배열을 기반으로 파일을 필터링하는 코드의 일부가 있습니다. 그것은 배열에서 whats와 동일한 것을 발견하는 부분에 대해 훌륭하게 작동하지만, 배열에 포함되지 않은 것을 기반으로 필터링하려고 할 때 찾을 수있는 "같지 않은"연산자의 버전을 무시합니다. 데이터 유형과 관련이 있다고 생각하지만 동등 연산자가 작동 할 때 왜 차이가 나는지 알 수 없습니다. 나는이 동일하지 않은 모든 다른 논리 연산자를 시도하고 그냥 그 부분을 무시하는 것 같다 Powershell 배열 내보내기 같지 않은 연산자가 작동하지 않습니다.
$msaClients = @("Widget, Inc","Johns Company")
$billingList = import-csv "c:\billing\billed.csv"
$idZero = "0"
$msaArray = foreach ($msa in $msaClients) {$billingList | where-object {$_.CustomerID -eq $msa -and $_."Accounted time" -ne $idZero}}
$laborArray = foreach ($msa in $msaClients) {$billingList | where-object {$_.CustomerID -ne $msa -and $_."Accounted time" -ne $idZero}}
$msaArray | export-csv c:\billing\msa.csv -notypeinformation
$laborArray | export-csv c:\billing\labor.csv -notypeinformation
CSV 파일
"Number","Ticket","Title","Customer User","CustomerID","Accounted time","Billing"
"1","2014041710000096","Calendar issues","george.jetson","Widget, Inc","0.25","Labor",""
"2","2014041710000087","Redirected Folder permission","jane.smith","Mars Bars, Inc.","1","Labor",""
"3","2014041610000203","Completed with No Files Changed ""QB Data""","will.smith","Dr. Smith","0","Labor",""
PowerShell을 코드입니다. 뭔가 옳지 않은 것처럼 보이면 코드에 훨씬 더 많은 부분이 있습니다.
무엇이 누락 되었습니까? 사전에 도움을 주셔서 감사합니다. 난이 올바른 이해한다면
당신은 절대적으로 흔들어서, 고맙습니다. – user3550556
다행히 도울 수 있어요 :) – Nitesh