ClimoC
Well-known Member
- Joined
- Aug 21, 2009
- Messages
- 584
Hello
I'm quite comfortable with building an array from a Project file, 25 columns wide and 10000 rows long, then dumping it into an Excel Spreadsheet.
I'm now essentially doing something similar in reverse though. I have a uniqueID-type column as column1 in the excel spreadsheet, and need to match this to a field in Project, then overwrite all the other fields based on what is in the array row.
My question is whether it would be (noticably) quicker to try and do this as an array, rather than with 20 scripting dictionaries? I know that seems like a rhetorical question on the face of it, but dictionaries are much easier to use, and I have access to the '.exists' functions, simple and quick adding etc.
And I suppose, how easy is it to 'loop' through my array and test conditions on it? I'd build a dictionary containing the task IDs and UniqueIDs : Would it be as simple as (quick example
...Or is there something I'm fundamentally missing here?
Thanks
C
I'm quite comfortable with building an array from a Project file, 25 columns wide and 10000 rows long, then dumping it into an Excel Spreadsheet.
I'm now essentially doing something similar in reverse though. I have a uniqueID-type column as column1 in the excel spreadsheet, and need to match this to a field in Project, then overwrite all the other fields based on what is in the array row.
My question is whether it would be (noticably) quicker to try and do this as an array, rather than with 20 scripting dictionaries? I know that seems like a rhetorical question on the face of it, but dictionaries are much easier to use, and I have access to the '.exists' functions, simple and quick adding etc.
And I suppose, how easy is it to 'loop' through my array and test conditions on it? I'd build a dictionary containing the task IDs and UniqueIDs : Would it be as simple as (quick example

Code:
For ArrR = 0 to UBound(MyArray,1)
If Dict.exists(MyArray(ArrR,1)) then
With Activeproject.tasks(MyArray(ArrR,1))
.Name = MyArray(ArrR,2)
.ResourceName = MyArray(ArrR,3)
.Duration = MyArray(ArrR,4) /480
.Text1 = MyArray(ArrR,5)
'etc
'etc
'etc
End With
Else
With Activeproject.tasks.add(MyArray(ArrR,1))
Dict.Add(MyArray(ArrR,1), .ID)
.Name = MyArray(ArrR,2)
'etc
'etc
End With
End If
ArrR = ArrR + 1
Loop
...Or is there something I'm fundamentally missing here?
Thanks
C