ASSN_UNITS bigger than 10,000 returns error

  • Thread starter Thiago Przybylovicz
  • Start date
T

Thiago Przybylovicz

Good day, everyone.

I'm creating programmatically resources and assignments for resources of
type material.

When I try to insert on Project an assigment with the value of ASSN_UNITS
bigger than 10,000 (making MY_VALUE * 10,000, because the project base has
it's unit values in a scale 1:10,000), I get the SoapException
"GenaeralUnitsInvalid". The PSClientError do not help in anything.

I'm posting the code that I use too. Please, help me, it's urgent.

Code:

public void AddAssignment(Guid resGuid, Guid taskGuid, DateTime startDate,
double realWork, bool notafiscal)
{
ProjectDataSet addProjAssig = new ProjectDataSet();
ProjectDataSet.AssignmentRow newAssignment =
addProjAssig.Assignment.NewAssignmentRow();
newAssignment.ASSN_UID = Guid.NewGuid();
newAssignment.PROJ_UID = guid;
newAssignment.RES_UID = resGuid;
newAssignment.ASSN_UNITS = (realWork * 10000); //on project
10000 = 1
newAssignment.TASK_UID = taskGuid;
if (notafiscal)
{
newAssignment.ASSN_ACT_WORK = (realWork * 60000); //60000 =
1h no project;
newAssignment.ASSN_WORK = 0;
}
else
{
newAssignment.ASSN_WORK = (realWork * 60000); //60000 = 1h
on project;
newAssignment.ASSN_ACT_WORK = 0; //60000 = 1h on project;
}
newAssignment.ASSN_ACT_START = startDate;

addProjAssig.Assignment.AddAssignmentRow(newAssignment);
AddToProject(sessionGuid, addProjAssig);
}
 
I

Igor Lankin

Hi Thiago,

as far as I know its 1:100 (at least with MAX_UNITS) , so 10000 would be
100%. Give it a try.

- Igor
 
T

Thiago Przybylovicz

Hello, Igor.

In Resources, for example, the units is really for max units (100%), just to
verify if the resource is overlocated. But in case of assignments, it receive
the value of the work for default. I searched on internet to know more about
this field but I didn't found a good explanation... The problem is that the
system who i'm developing uses the UNITS value to get the value of the
material resource...

In Project Professional I can put the units bigger than 10,000 and the
application accepts it... Programmaticaly, I don't...
 
S

Subramanian Vasudevan

Hi Thiago,

I used to face the same problem long time back. I decided to use ASSN_WORK
instead of ASSN_UNITS, EVEN for Material Resources and Project Server stopped
complaining. :) I also had to go figure out the weird multiplier I had to use
for the ASSN_WORK.

Here's how you use it:
ASSN_WORK = (Units of Material Resource) * 60,000;

Cheers,

Subramanian
 
T

Thiago Przybylovicz

I found it too... I already told to the system analyst to change the field
that will give less headache for us...

Thank you for the answer! If you can help me, see the another post that I
made yesterday, because the other is more urgent... Thanks!!!
 
S

Subramanian Vasudevan

Hi Thiago,

You are welcome. I'll now see if I can help you out with the other issue.

Subramanian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Error with QueueAddToProject 0
Error creating tasks 3

Top