2012-12-30 3 views
-2

EDIT값 Arrayist 개체의 인 removeRange 방법에 의해 제거되지

Option Explicit 

Dim ParentArr : ParentArr = Array("47266943","UPDATE/ENABLE SUPPLIER ADDRESS - Water","F48471101","ASHLAND INDUSTRIES EUROPE GMBH","Tier 4 Review","Bihacker, Zoltán Árpád", 
"9/4/12 3:34 AM","9/25/12 3:06 PM","Closed", 
"Water and Process Technologies/Direct - Chemicals/Europe - United Arab Emirates","47266943", 
"Return to Requestor (Update/Enable WF) - Water","09/04/2012 04:59:36 AM","Bihacker, Zoltán Árpád","Bihacker, Zoltán Árpád", 
"Return to Requestor (Update/Enable WF) - Water","09/06/2012 08:29:34 AM","Bihacker, Zoltán Árpád","Bihacker, Zoltán Árpád", 
"Requestor Provides Business Specific Supplier Details - Update/Enable Supplier","09/04/2012 03:34:32 AM","Bihacker, Zoltán Árpád","Bihacker, Zoltán Árpád", 
"Requestor Provides Supplier Details - Update/Enable Supplier","09/04/2012 03:40:22 AM","Bihacker, Zoltán Árpád", 
"Bihacker, Zoltán Árpád","VMH All Fields Review (Req. Provides Supplier Details) - Update/Enable Supplier","09/11/2012 01:43:53 AM", 
"Karve, Vinod","Karve, Vinod","VMH All Fields Review (Req. Provides Supplier Details) - Update/Enable Supplier","09/04/2012 04:59:36 AM", 
"Karve, Vinod","Karve, Vinod","VMH All Fields Review (Req. Provides Supplier Details) - Update/Enable Supplier","09/06/2012 08:29:34 AM", 
"Karve, Vinod","Karve, Vinod","Sourcing Final Review of Supplier Self-Serve - Update/Enable Supplier","09/17/2012 08:59:36 AM", 
"Karve, Vinod","Karve, Vinod","Sourcing Final Review of Supplier Self-Serve - Update/Enable Supplier","09/19/2012 08:29:34 AM","Karve, Vinod", 
"Karve, Vinod","Sourcing Final Review of Requestor Provided Details - Update/Enable Supplier","09/11/2012 04:52:28 PM","Vekemans, Ilse", 
"Vekemans, Ilse","Sourcing Final Review of Requestor Provided Details - Update/Enable Supplier","09/18/2012 08:59:36 AM","Karve, Vinod", 
"Karve, Vinod","Sourcing Final Review of Requestor Provided Details - Update/Enable Supplier","09/20/2012 08:29:34 AM","Karve, Vinod", 
"Karve, Vinod","Resend Supplier Survey - Update/Enable Supplier","09/26/2012 08:29:34 AM","Karve, Vinod","Karve, Vinod", 
"Resend Supplier Survey - Update/Enable Supplier","09/24/2012 08:59:36 AM","Karve, Vinod","Karve, Vinod", 
"Supplier Starts Survey - Update/Enable Supplier","09/25/2012 08:59:36 AM","Karve, Vinod","Karve, Vinod", 
"Supplier Starts Survey - Update/Enable Supplier","09/27/2012 08:29:34 AM","Karve, Vinod","Karve, Vinod", 
"Supplier Completes Survey - Update/Enable Supplier","11/08/2012 08:29:34 AM","Karve, Vinod","Karve, Vinod", 
"Supplier Completes Survey - Update/Enable Supplier","11/06/2012 08:59:36 AM","Karve, Vinod","Karve, Vinod", 
"VMH All Fields Review of Supplier Survey - Update/Enable Supplier","1/07/2012 08:59:36 AM","Karve, Vinod","Karve, Vinod", 
"VMH All Fields Review of Supplier Survey - Update/Enable Supplier","11/09/2012 08:29:34 AM","Karve, Vinod","Karve, Vinod", 
"Sourcing Review of Supplier Survey - Update/Enable Supplier","11/13/2012 08:59:36 AM","Karve, Vinod","Karve, Vinod", 
"Sourcing Review of Supplier Survey - Update/Enable Supplier","11/15/2012 08:29:34 AM","Karve, Vinod","Karve, Vinod", 
"Sourcing Quality Review of Supplier Survey - Update/Enable Supplier","11/14/2012 08:59:36 AM","Karve, Vinod", 
"Sourcing Quality Review of Supplier Survey - Update/Enable Supplier","09/12/2012 02:41:01 AM","Schreurs, Rene","Schreurs, Rene", 
"Sourcing Quality Review of Supplier Survey - Update/Enable Supplier","11/16/2012 08:29:34 AM","Karve, Vinod","Karve, Vinod", 
"Finance Review of Supplier Survey - Update/Enable Supplier","09/21/2012 08:30:17 AM","Bruck, Barbara","Bruck, Barbara", 
"Finance Review of Supplier Survey - Update/Enable Supplier","11/15/2012 08:59:36 AM","Karve, Vinod","Karve, Vinod", 
"Finance Review of Supplier Survey - Update/Enable Supplier","11/19/2012 08:29:34 AM","Karve, Vinod","Karve, Vinod", 
"Activate/Create supplier in business system - Update/Enable Supplier","11/16/2012 08:59:36 AM","Karve, Vinod","Karve, Vinod", 
"Activate/Create supplier in business system - Update/Enable Supplier","11/20/2012 08:29:34 AM","Karve, Vinod","Karve, Vinod", 
"Activate/Create supplier in business system - Update/Enable Supplier","09/24/2012 04:01:28 AM","Goud, Siddhartha","Goud, Siddhartha") 

Dim VMHArray : VMHArray = Array("VMH All Fields Review - Add Supplier Emergency","VMH All Fields Review (Req. Provides Supplier Details) - Update/Enable Supplier","VMH Triggered Final Sourcing Review - Add Address_Direct","Activate/Create supplier in business system - Add Address","Activate/Create supplier in Business System - Add Supplier","Activate/Create supplier in Business System - Add Supplier Emergency","Activate/Create supplier in business system - Update/Enable Supplier","Resend Supplier Survey - Add Address","Resend Supplier Survey - Add Supplier","Resend Supplier Survey - Add Supplier","Resend Supplier Survey - Update/Enable Supplier","SSS BTP Team – Add Address","SSS BTP Team – Update/Enable Supplier","SSS BTP Team E","SSS BTP Team S","SSS BTP Team-Update/Activate Supplier ","VMH All Fields Review (Req. Provides Supplier Details) - Update/Enable Supplier","VMH All Fields Review - Add Address","VMH All Fields Review - Add Supplier","VMH All Fields Review - Add Supplier Emergency","VMH All Fields Review of Supplier Survey - Add Address","VMH All Fields Review of Supplier Survey - Add Supplier","VMH All Fields Review of Supplier Survey - Add Supplier Emergency","VMH All Fields Review of Supplier Survey - Update/Enable Supplier","VMH Bank Review - Edit Supplier/Address_Direct","VMH Bank Review - Push To Downstream","VMH Edit Supplier/Address_Direct","VMH Inputs Supplier Details - Add Address_Direct","VMH Inputs Supplier Details - Add Supplier_Direct","\VMH Triggered Final Sourcing Review - Add Address_Direct","Activate/Create supplier in business system - Add Address","Activate/Create supplier in Business System - Add Supplier","Activate/Create supplier in Business System - Add Supplier Emergency","Activate/Create supplier in business system - Update/Enable Supplier","Resend Supplier Survey - Add Address","Resend Supplier Survey - Add Supplier","Resend Supplier Survey - Add Supplier","Resend Supplier Survey - Update/Enable Supplier","SSS BTP Team – Add Address","SSS BTP Team – Update/Enable Supplier","SSS BTP Team E","SSS BTP Team S","SSS BTP Team-Update/Activate Supplier ","VMH All Fields Review (Req. Provides Supplier Details) - Update/Enable Supplier","VMH All Fields Review - Add Address","VMH All Fields Review - Add Supplier","VMH All Fields Review - Add Supplier Emergency","VMH All Fields Review of Supplier Survey - Add Address","VMH All Fields Review of Supplier Survey - Add Supplier","VMH All Fields Review of Supplier Survey - Add Supplier Emergency","VMH All Fields Review of Supplier Survey - Update/Enable Supplier","VMH Bank Review - Edit Supplier/Address_Direct","VMH Bank Review - Push To Downstream","VMH Edit Supplier/Address_Direct","VMH Inputs Supplier Details - Add Address_Direct","VMH Inputs Supplier Details - Add Supplier_Direct","VMH Supplier Validation - Add Address","VMH Supplier Validation - Add Supplier","VMH Supplier Validation - Update/Enable Supplier","VMH Triggered Final Sourcing Review - Edit Supplier/Address_Direct","VMH Watchlist Review - Add Address","VMH Watchlist Review - Add Address_Direct","VMH Watchlist Review - Add Supplier","VMH Watchlist Review - Add Supplier_Direct","VMH Supplier Validation - Add Supplier","VMH Supplier Validation - Update/Enable Supplier","VMH Triggered Final Sourcing Review - Edit Supplier/Address_Direct","VMH Watchlist Review - Add Address","VMH Watchlist Review - Add Address_Direct","VMH Watchlist Review - Add Supplier","VMH Watchlist Review - Add Supplier_Direct") 

Dim i,IndexSearch 
Dim ArrayListTaskDetails : Set ArrayListTaskDetails = CreateObject("System.Collections.ArrayList") 

For i=Lbound(ParentArr) To Ubound(ParentArr) 

    ArrayListTaskDetails.Add(ParentArr(i)) 

Next 

For IndexSearch = Lbound(VMHArray) To Ubound(VMHArray) 

Do Until ArrayListTaskDetails.IndexOf(VMHArray(IndexSearch), 0) = -1 

RemovePosition = ArrayListTaskDetails.IndexOf(VMHArray(IndexSearch), 0) 
'MsgBox(RemovePosition) 
ArrayListTaskDetails.RemoveRange RemovePosition, 4 

Loop 

Next 
+0

처음 두 코드 조각을 읽을 수 있도록 다시 포맷하면 더 많이 디버그하려고합니다. –

+0

@DanielCook 첫 번째 배열은 대체 할 'VMHArray'에있는 요소의 배열입니다. 그러나 내 코드에서는 작동하지 않습니다. –

+0

@DanielCook 내 전체 코드를 볼 수 있지만 제거가 entierly 완료되지 않은 것 같습니까? 벌레가 어디 있는지 몰랐어. 도와 줘! –

답변

1
로서 출력에서 ​​알 수

이 데모 스크립트

alSrc: a.x.x.x.b.c.d.e.x.x.x.f.a.x.x.x. 
aRmv: a.e.i 
a 0 a.x.x.x.b.c.d.e.x.x.x.f.a.x.x.x. 
a 8 b.c.d.e.x.x.x.f.a.x.x.x. 
a -1 b.c.d.e.x.x.x.f. 
e 3 b.c.d.e.x.x.x.f. 
e -1 b.c.d.f. 
i -1 b.c.d.f. 
alSrc: b.c.d.f. 

:

Dim alSrc : Set alSrc = CreateObject("System.Collections.ArrayList") 
    Dim sE 
    For Each sE In Split("a x x x b c d e x x x f a x x x ") 
     alSrc.Add sE 
    Next 
    WScript.Echo "alSrc:", Join(alSrc.ToArray(), ".") 
    Dim aRmv : aRmv = Split("a e i") 
    WScript.Echo "aRmv:", Join(aRmv, ".") 
    Dim nI 
    For Each sE In aRmv 
     Do 
     nI = alSrc.IndexOf(sE, 0) 
     WScript.Echo sE, nI, Join(alSrc.ToArray(), ".") 
     If -1 < nI Then alSrc.RemoveRange nI, 4 
     Loop Until -1 = nI 
    Next 
    WScript.Echo "alSrc:", Join(alSrc.ToArray(), ".") 

을 사용하면 모든 범위의 바늘 (a, e)을 철저히 제거하고 세 개의 elemen ts (x x x)를 ArrayList로부터 구한다. 범인은 당신의 코드 나 데이터를해야합니다 (즉, 당신을) : 실제 결과 대 예상의

는만큼 당신은 말할 수 I이며, 자세한 설명을 제공하지 않습니다.

+0

'Do-LOOP'과 나의 Do-LOOP가 동일하거나 또는 당신과 같은 구조 조정이 필요하다면 확인할 수 있습니까? –

+0

@VBSlover - 루프를 내 데모 코드에 넣고 직접 보시겠습니까? –

+0

arraylist에는 데이터를 유지하는 데 최대 한도가 있습니까? –

관련 문제