Performance issue on writing timephased data

Someone knows why writing timephased data through code has such a bad
performance?

I've have develop a procedure to import the assignment timephased data
from a excel file into project.

This procedure is a Project add-in written in c#.

Here's a sample of the code that runs for each assignment:


Code:
--------------------
    oRCProject.Application.OptionsCalculation(false, false, false, false, false, Missing.Value, false, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
  for (int iQuarter = 0; iQuarter < aQuarters.Count; iQuarter++)
  {
  MSProject.TimeScaleValues oNewAssTSV = oNewAss.TimeScaleData(dtQuarterStart, dtQuarterFinish, MSProject.PjAssignmentTimescaledData.pjAssignmentTimescaledWork, MSProject.PjTimescaleUnit.pjTimescaleQuarters, 1);
  double dQuarterValue = Convert.ToDouble(aQuarters[iQuarter]);
  oNewAssTSV[1].Value = dQuarterValue;
  }
--------------------

The last line of code has a very long execution time, 90% of the
elaboration time has been occupied by these code.
Furthermore the execution time grows at each call, passing from a 10ms
to 300ms after 3000 hits. 
Obviously it's not only a write of a value, there're other operations
performed.
Someone know what kinds of operations are performed by this call?
There's a way to disable these operations and postpone them after the
finish of the procedure?

Thanks


-- 
fleuz
------------------------------------------------------------------------
fleuz's Profile: http://forums.techarena.in/members/171998.htm
View this thread: http://forums.techarena.in/microsoft-project/1291092.htm

http://forums.techarena.in

0
fleuz
1/8/2010 9:59:31 AM
project 1276 articles. 0 followers. Follow

2 Replies
1075 Views

Similar Articles

[PageSpeed] 39

I would first write this coder in VBA and get it working. Add-ins are 
inherently slower than VBA which runs in the same process as the App. If VBA 
is slow, then Project is the problem. If not, then your addin is.

I don't understand the MSProject.TimeScaleValues oNewAssTSV = 
oNewAss.TimeScaleData(dtQuarterStart line:

If you work with the timescalevalues of a new Assignment variable without 
first pointing the variable to an existing assignment, you will get very 
strange results which I think is what you have!

Get it working in VBA then port to Visual Studio. This process is obviously 
much faster and easier when writing in VB, which is what I recommend for 
office Add-in development.

-- 

Rod Gill
Microsoft MVP for Project - http://www.project-systems.co.nz

Author of the only book on Project VBA, see: http://www.projectvbabook.com




"fleuz" <fleuz.44gtrc@DoNotSpam.com> wrote in message 
news:fleuz.44gtrc@DoNotSpam.com...
>
> Someone knows why writing timephased data through code has such a bad
> performance?
>
> I've have develop a procedure to import the assignment timephased data
> from a excel file into project.
>
> This procedure is a Project add-in written in c#.
>
> Here's a sample of the code that runs for each assignment:
>
>
> Code:
> --------------------
>    oRCProject.Application.OptionsCalculation(false, false, false, false, 
> false, Missing.Value, false, Missing.Value, Missing.Value, Missing.Value, 
> Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, 
> Missing.Value);
>  for (int iQuarter = 0; iQuarter < aQuarters.Count; iQuarter++)
>  {
>  MSProject.TimeScaleValues oNewAssTSV = 
> oNewAss.TimeScaleData(dtQuarterStart, dtQuarterFinish, 
> MSProject.PjAssignmentTimescaledData.pjAssignmentTimescaledWork, 
> MSProject.PjTimescaleUnit.pjTimescaleQuarters, 1);
>  double dQuarterValue = Convert.ToDouble(aQuarters[iQuarter]);
>  oNewAssTSV[1].Value = dQuarterValue;
>  }
> --------------------
>
> The last line of code has a very long execution time, 90% of the
> elaboration time has been occupied by these code.
> Furthermore the execution time grows at each call, passing from a 10ms
> to 300ms after 3000 hits.
> Obviously it's not only a write of a value, there're other operations
> performed.
> Someone know what kinds of operations are performed by this call?
> There's a way to disable these operations and postpone them after the
> finish of the procedure?
>
> Thanks
>
>
> -- 
> fleuz
> ------------------------------------------------------------------------
> fleuz's Profile: http://forums.techarena.in/members/171998.htm
> View this thread: http://forums.techarena.in/microsoft-project/1291092.htm
>
> http://forums.techarena.in
>
>
> __________ Information from ESET Smart Security, version of virus 
> signature database 4733 (20091231) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>
> 

__________ Information from ESET Smart Security, version of virus signature database 4733 (20091231) __________

The message was checked by ESET Smart Security.

http://www.eset.com



0
Rod
1/9/2010 3:10:06 AM
This is a multi-part message in MIME format.

------=_NextPart_000_00BB_01CA92D7.9C2DED80
Content-Type: text/plain;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

Hi fleuz,

Try posting on the microsoft.public.project.developer newsgroup (forum). =
 Please see FAQ Item: 24. Project Newsgroups.   FAQs, companion products =
and other useful Project information can be seen at this web address: =
http://project.mvps.org/faqs.htm=20

Mike Glen
Project MVP


  "fleuz" <fleuz.44gtrc@DoNotSpam.com> wrote in message =
news:fleuz.44gtrc@DoNotSpam.com...

  Someone knows why writing timephased data through code has such a bad
  performance?

  I've have develop a procedure to import the assignment timephased data
  from a excel file into project.

  This procedure is a Project add-in written in c#.

  Here's a sample of the code that runs for each assignment:


  Code:
  --------------------
      oRCProject.Application.OptionsCalculation(false, false, false, =
false, false, Missing.Value, false, Missing.Value, Missing.Value, =
Missing.Value, Missing.Value, Missing.Value, Missing.Value, =
Missing.Value, Missing.Value, Missing.Value);
    for (int iQuarter =3D 0; iQuarter < aQuarters.Count; iQuarter++)
    {
    MSProject.TimeScaleValues oNewAssTSV =3D =
oNewAss.TimeScaleData(dtQuarterStart, dtQuarterFinish, =
MSProject.PjAssignmentTimescaledData.pjAssignmentTimescaledWork, =
MSProject.PjTimescaleUnit.pjTimescaleQuarters, 1);
    double dQuarterValue =3D Convert.ToDouble(aQuarters[iQuarter]);
    oNewAssTSV[1].Value =3D dQuarterValue;
    }
  --------------------

  The last line of code has a very long execution time, 90% of the
  elaboration time has been occupied by these code.
  Furthermore the execution time grows at each call, passing from a 10ms
  to 300ms after 3000 hits.=20
  Obviously it's not only a write of a value, there're other operations
  performed.
  Someone know what kinds of operations are performed by this call?
  There's a way to disable these operations and postpone them after the
  finish of the procedure?

  Thanks


  --=20
  fleuz
  =
------------------------------------------------------------------------
  fleuz's Profile: http://forums.techarena.in/members/171998.htm
  View this thread: =
http://forums.techarena.in/microsoft-project/1291092.htm

  http://forums.techarena.in

------=_NextPart_000_00BB_01CA92D7.9C2DED80
Content-Type: text/html;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3Dtext/html;charset=3DWindows-1252 =
http-equiv=3DContent-Type>
<META name=3DGENERATOR content=3D"MSHTML 8.00.7600.16466"></HEAD>
<BODY style=3D"PADDING-LEFT: 10px; PADDING-RIGHT: 10px; PADDING-TOP: =
15px"=20
id=3DMailContainerBody leftMargin=3D0 topMargin=3D0 =
CanvasTabStop=3D"true"=20
name=3D"Compose message area">
<DIV><FONT face=3D"Comic Sans MS">Hi fleuz,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D"Comic Sans MS">Try posting on the=20
microsoft.public.project.developer newsgroup (forum).&nbsp; Please see =
FAQ Item:=20
24. Project Newsgroups.&nbsp;&nbsp; FAQs, companion products and other =
useful=20
Project information can be seen at this web address: <A=20
href=3D"http://project.mvps.org/faqs.htm">http://project.mvps.org/faqs.ht=
m</A>=20
</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D"Comic Sans MS">Mike Glen<BR>Project MVP</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D"Comic Sans MS"></FONT>&nbsp;</DIV>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; =
PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">
  <DIV>"fleuz" &lt;<A=20
  title=3D"mailto:fleuz.44gtrc@DoNotSpam.com&#10;CTRL + Click to follow =
link"=20
  =
href=3D"mailto:fleuz.44gtrc@DoNotSpam.com">fleuz.44gtrc@DoNotSpam.com</A>=
&gt;=20
  wrote in message <A=20
  title=3D"news:fleuz.44gtrc@DoNotSpam.com&#10;CTRL + Click to follow =
link"=20
  =
href=3D"news:fleuz.44gtrc@DoNotSpam.com">news:fleuz.44gtrc@DoNotSpam.com<=
/A>...</DIV><BR>Someone=20
  knows why writing timephased data through code has such a=20
  bad<BR>performance?<BR><BR>I've have develop a procedure to import the =

  assignment timephased data<BR>from a excel file into =
project.<BR><BR>This=20
  procedure is a Project add-in written in c#.<BR><BR>Here's a sample of =
the=20
  code that runs for each=20
  =
assignment:<BR><BR><BR>Code:<BR>--------------------<BR>&nbsp;&nbsp;&nbsp=
;=20
  oRCProject.Application.OptionsCalculation(false, false, false, false, =
false,=20
  Missing.Value, false, Missing.Value, Missing.Value, Missing.Value,=20
  Missing.Value, Missing.Value, Missing.Value, Missing.Value, =
Missing.Value,=20
  Missing.Value);<BR>&nbsp; for (int iQuarter =3D 0; iQuarter &lt;=20
  aQuarters.Count; iQuarter++)<BR>&nbsp; {<BR>&nbsp; =
MSProject.TimeScaleValues=20
  oNewAssTSV =3D oNewAss.TimeScaleData(dtQuarterStart, dtQuarterFinish,=20
  MSProject.PjAssignmentTimescaledData.pjAssignmentTimescaledWork,=20
  MSProject.PjTimescaleUnit.pjTimescaleQuarters, 1);<BR>&nbsp; double=20
  dQuarterValue =3D Convert.ToDouble(aQuarters[iQuarter]);<BR>&nbsp;=20
  oNewAssTSV[1].Value =3D dQuarterValue;<BR>&nbsp;=20
  }<BR>--------------------<BR><BR>The last line of code has a very long =

  execution time, 90% of the<BR>elaboration time has been occupied by =
these=20
  code.<BR>Furthermore the execution time grows at each call, passing =
from a=20
  10ms<BR>to 300ms after 3000 hits. <BR>Obviously it's not only a write =
of a=20
  value, there're other operations<BR>performed.<BR>Someone know what =
kinds of=20
  operations are performed by this call?<BR>There's a way to disable =
these=20
  operations and postpone them after the<BR>finish of the=20
  procedure?<BR><BR>Thanks<BR><BR><BR>--=20
  =
<BR>fleuz<BR>------------------------------------------------------------=
------------<BR>fleuz's=20
  Profile: <A=20
  =
href=3D"http://forums.techarena.in/members/171998.htm">http://forums.tech=
arena.in/members/171998.htm</A><BR>View=20
  this thread: <A=20
  =
href=3D"http://forums.techarena.in/microsoft-project/1291092.htm">http://=
forums.techarena.in/microsoft-project/1291092.htm</A><BR><BR><A=20
  =
href=3D"http://forums.techarena.in">http://forums.techarena.in</A><BR></B=
LOCKQUOTE></BODY></HTML>

------=_NextPart_000_00BB_01CA92D7.9C2DED80--

0
Mike
1/11/2010 4:03:26 PM
Reply:

Similar Artilces:

MacTopia not Posting Issues
Version: 2004 Operating System: Mac OS X 10.4 (Tiger) Processor: intel How come every time I post a question in the Word forum it shows up on the My Account page as a question posted to MacTopia? If I search the Word forum or the entire Mactopia site I don't see my "permission and memory full errors" post? I tried posting this issue twice to the Word forum without success. Oddly, it is listed in the My Participation column on my account page. I tried even searching all of Mactopia by my user name only to see old Entourage post but the newer post. fjm Hi fjm - I honestly do...

Copying Data between Spreadsheets based on a rows value
Hi there, Looking for a bit of assistance in Excel with VB macro. I have 2 spreadsheets. One has an order number and a few cells of data. The second has a column of order numbers and each row has data regarding that order. I am looking for code that will run when an on screen button is pressed that grabs the order number and data from the first spreadsheet and then in the new spreadsheet look for the row which has the same order number (In say column A) and paste the data in another column in that row (Say column M). EG. Spreadsheet 1 Order Number Data1 Data2 Data3 5468 ...

exchange 2003 and global catalog server issue
Question I have 2 domain controllers server1 and server2. Both have Win2000 SP4. Server1 has been successfully a global catalog server. For backup purposes, I made server2 a global catalog as well. I am running Exchange2003 which uses server1 as its global catalog server, when I unplug the ethernet cable from server1, I cannot logon to email even though server2 (the newly promoted global catalog server) is still plugged into the network. Any Ideas? What error message do you get ? Do any of the Exchange services on the Exchange server stop working ? What version of Outlook is being used...

How do I make source data for pivot variable.
I recorded the following code as I built a pivot table. The data for this particular table was 3 columns wide and 300 rows down. My problem is that the number of rows in my data is always different. One day may be 300 another 345, or 280. Rigth now I modify my pivot to pick up more rows than my data will ever have, I hope, and adjust the data by adding filler rows to make it a constant to match the rows my pivot table picks up. How can I get my pivot table to always scoop up exactly the number of rows containing the data. No more rows or less, and eliminate the other adjusting filler code. I...

Re: data manipulation
Hi All, I currently have an excel file which I need to re-format. The fil contains 18 columns as follows : Prefix Number Service Date Given Name Surname DOB Panels1 Panels2 Panels3 Panels4 Panels5 Panels6 Panels7 Panels8 Panels9 Panels10 R$$ item Value The problem I have relates to the 10 columns which contain informatio related to "Panels". The original Panel data was contained in on column ie: Service date Panel May 97 xxx, xxx, xxx, xxx I have separated this data by using "text to columns", however, if th service date...

performances
performances Hi, I am writing c++ application in vc++ 6 the application use a lot of cpu processing (math calculations), I am running the application on Win-XP, p-4 2.8 HT! What is the best way to compile my application so it will run faster? What are the best ways to write or build my application for faster running? What i the different betwine processor type Blend* inn the C/C++ tab of the project setting and the other option??? Thanks! "Dave" <dbg@012.net.il> wrote in message news:eY8jUE38EHA.3756@TK2MSFTNGP14.phx.gbl... > performances > > Hi, > I am wr...

Date Modified sort issue.
Good afternoon. The issue is that when I sort (right-click --> arrange icons by --> Modified or click on the Date Modified header), it sorts by Date Modified, but categorizes by the Name (Folders, Shortcuts, Files. etc.). I was wondering if anyone knew of a way to sort an entire folder (either ascending or decending) by Date Modified. Thank you, WHEELS -------- Original-Nachricht -------- > Good afternoon. > > The issue is that when I sort (right-click --> arrange icons by --> Modified > or click on the Date Modified header), it sorts by Da...

Money 2006 to Money Plus Issues
i recently received an messaage in money 2006 indicating my financial transaction download capabilities had expired so i need to purchase the new version of Money Plus (2008). When i installed money plus and attempted to run it, it attempted to begin conversion on my database (.mny) file. i received the message, "money has stopped working" before the conversion completed. i reinstalled version 2006, but much of the software is not functional (i.e. reports and budget). There is a message indicating the features are not available and download is only 1% complete. how do i g...

Sorting data on button click
Hi guys ! I have one sheet with cca 400 rows, divided in columns like name, date, location, number etc. Now, what i want to do is to create something like in windows explorer. One "menu" where you can click on name, size, type, date modified etc. and on click, columns should be sorted ascending or descending. The same as in windows explorer.... How to make this ? John, You can do this by applying the autofilter to the sheet. Select a cell in the region of the list/table and click Data/Filter/AutoFilter. You now have dropdowns for each column. If you scro...

Software update issue
I've installed Money 2007 H&B and my location is China.Then every time I launched the program,it says something like "To operate correctly,click 'ok' to let Money download the software update." But if I click 'OK',after it download autoupdate.dll(.cab) and autoupdate.xml,it alarms "A software update is already in progress.Please try again when the update is complete." How can I solve the problem ? ...

Autofill Issues in Microsoft Outlook 2007
Hi, I have two problems. 1. a co-worker's autofill feature isn't working for all of her contacts. Her computer crashed a while back and she moved to a new one. I performed all the steps to copy the .NK2 file to her outlook folder but it didn't do anything. She has several users on her computers with multiple .NK2 files (one is even in a downloads folder); I'm not sure if I'm looking in the correct folder because her user doesn't have an outlook folder where I can locate an .NK2. I unhid the all the files before I tried to perform this operation as well....

Importing ACT! 6.0 data into Outlook 2002
I have a large data base of contacts in ACT! 6.0 that I now want to import into Outlook 2002. The IMPORT feature of my Outlook does not have a selection for ACT data. How do I accomplish this? What formats does Act 6 support for export? Select one of those and then try importing into Outlook. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all mail sent to my personal account will be deleted without reading. After searching google.groups.com and finding no answer, Tom K asked: | I have a lar...

vba macro to perform custom reporting -transpose from rows to columns
I have one workbook and two sheets 1 sheet has data for automated test scenarios that may be run up to 3 time if they don't pass on the first or second try Sheet1: TestSet Test Result reason if failed 1 pass 2 pass 3 pass 4 fail x 4 fail y 4 fail z I want to create a summary report that looks like Sheet2 for the Sheet1 logs above test run1 result test run2 result test run 3result Sheet2 Testset result1 result2 result3 1 pass 2 pass 3 pass 4 fail fail fail So if a testset is executed more ...

Some of the data in a column in view is being truncated
I created a view that creates a single column with a long string. this string is used to export to a .txt file to be sent electronically. Well if the results are sent to grid all of the data is there, but if its sent to a file or text then some of the data has been truncated. The length of the column varies, but its about 278 chars long. Any knowledge as to why its doing this? -- Thanks for your help Are you sending to the .txt file via the SQL Server Management Studio query window? If so, its default setting is to limit strings to 256 bytes. You can set this in the qu...

One data series and two y-axes in an Excel chart?
I would like to produce graph of a single data series such that the left y-axis would represent the absolute value and the right axis the relative values (in percents) of the data points. An example of such a chart is the last graph on the page <http://www.abs.gov.au/websitedbs/D3310116.NSF/0/c7e40ae1fa39e31e4a2567ac001ffb61?OpenDocument> with cumulative frequency on the left axis and cumulative percentage on the right axis. Is it possible to create charts like these with Excel? kkarvinen, Yes, you can create a chart similar to your example chart by using an XY-Scatter Chart. As a...

Move a table with LOB data from one filegroup to another.
Okay, I have determined that the method I have found for moving a table from one Filegroup to another (drop and recreate the primary key on the filegroup) does not move LOB data in SQL Server 2005. According to BOL the method for setting this storage is in CREATE TABLE (TEXTIMAGE_ON). So, I am assuming I will have to rename the existing table (I was planning on using sp_rename) and it's index, and then re-creating it on the new filegroup, and then copying the data using insert [tablename] select * from [renamedtable] drop table [renamedtable Which has 'worked...

External data properties
I have imported data into Excel 2007. The headings are the field names from teh table I imported. In Excel 2003 I could remove the table headings in "External Data Properties" by ticking a box. That option doesn't seem to be there in 2007. Any suggestions how I can do this? ...

How do I get text to write over pictures?
I would like to have text in a newsletter sit on top of a faint picture. 've tried to make picture more transparent by adjusting brightness and contrast. In order, I've sent pic backwards and bought text boxes forward. I've selected text wrapping on picture as through. It looks okay on screen but when I print or print preview, the picture sits at front and the text sits behind (or the picture disappears altogether). Would love to know how to create affect of words over a faint picture. Have you tried the *wash out*? It is on the picture toolbar, the icon that appears as a b...

KB for Performance Optimizer trouble
In the process of moving EDB files from a crashed server to a new server built with same name, etc, but different platform (from NT to W2K Sp4) I found the Performance Optimizer would not allow me to move files to different volumes. A quick google search showed because of SP4 I needed to contact Microsoft for the patch but when I called they said I needed the KB article and I searched and searched and even none of the 'MVP' replies saying 'contact microsoft' had the KB number. After having the MS rep hold the line while I was scouring google and retrying the process to get the ...

Business Contact Manager, performance sacrifices?
I'm hoping we can all learn a little about Business Contact Manager... After some initial difficulties that were resolved by 1.5 hours with Microsoft and some great ideas from Patricia Cardoza's new book, I've got Business Contact Manager running smoothly. That's a good thing because I provide support and training in Outlook to clients and want to be able to recommend this new add-on. But is it ready to recommend? Here are two things that seriously bother me: my contacts take so much longer to load and sort. Searching from the "Find a Contact" box formerly t...

Perform function...if?
Hi I have a workbook that I'm continually adding data to daily. and I also have another workbook that I want to perform calculations, but I only want the calculations performed IF there is data in the first workbook... Here are the two formulas the way they are now... ='Stock Return Data'!J24*0.25 ='Stock Return Data'!J24-'Tax Data'!A14 How can I tell both these functions, to only perform if there is data on the original worksheet? Thanks, Confused Man Hi try =IF('Stock Return Data'!J24<>"",'Stock Return Data'!J24*0.25,"&...

Easiest way to "transpose" data?
I have a table, laid out as follows: Acct, Year, period1, period2, period3, period4,...through period13 Sales 2006 $1000 $2500 $3100 $1250 What is the easiest way to return each record as 12 records, Acct Year Period, Amount Sales 2006 Period1 $1000 Sales 2006 Period2 $2500 Sales 2006 Period3 $3100 Sales 2006 Period4 $1250 I can't mess with the table structure, and I actually have a bunch of different tables I will need to view in a similar fashion. I can figure ways to do it, but I am sure some of the genius level talent here has an easy way to do this? Phil If we were ...

W7 hardware issue
Running w7 64 pro When I built the system, I installed 3 HDD's which were recognized as LUN 0, 1 & 2. As it turns out I installed W7 on LUN 2 which then became the "C" drive. Made three partitions so the LUN 2 drive became C,D & E. The LUN0 drive is F and the LUN 1 drive is G Had a problem which resulted in a "Select Boot Device and press a key error" - couldn't boot system. Tried a repair from the W7 CD - no joy. Was able to determine that W7 was looking for the OS on LUN 0 and would not look anywhere else. Ultimately, I disconnected...

Your path to data is incorrect
I am completely new to Great Plains. I was trying to install the package (7.5 version) and I am stuck at this stage: I have been able to install the package and create two companies using the utilities. I then tried to enter the package. After the initial login dialog, I get to see the error message : Your path to data is incorrect There is a textbox with the label:Location of Pathname File and this is initialized to DYNAMICS/dbo If I press Ok and go ahead, I get a couple of more error dialogs. Ultimately, I am not able to open any transactional screen. I saw that the database DYNAM...

How can I combine data that is in 2 rows to 1 row
Hello I have a file that has only 1 data point (name of an institution) in row 1 column 1 and then multiple data points (city of the institution and other results) in row 2 column 1-7. I would like to combine the data in consecutive rows into 1 so I can work (sort results in different columns) with the data. As you can imagine the file has 2000 rows but the data addresses only 1000 institutions. I Would appreciate any help thanks albert explained : > Hello > > I have a file that has only 1 data point (name of an institution) in row 1 > column 1 and then multiple data points...