Forum Discussion
KR
Mar 27, 2021Copper Contributor
How to Display Blank field using custom field
Hi Have 2 questions with regard to Ms Project custom field usage. 1. I have a very simple question but I don't seem to be able to get it right. I am trying display a blank field on a new cus...
- Mar 29, 2021Okay I've got something that appears to work.
1. In the Resource Usage or Resource Sheet customize the Resource Text1 field with this formula and check the option to "use formula" for task and group summary rows::
IIf([Budget Cost]<>"",round([Number1],1) & "%","")
2. This macro will populate the Resource Number1 field with the desired percentage data
Sub CustomBud()
Dim Den As Single
Dim CFF As String
Den = Round(ActiveProject.ProjectSummaryTask.BudgetCost)
CFF = "iif([budget cost]<>"""",[budget cost]/" & Den & "*100,0)"
CustomFieldSetFormula FieldID:=pjCustomResourceNumber1, Formula:=CFF
CustomFieldPropertiesEx FieldID:=pjCustomResourceNumber1, Attribute:=pjFieldAttributeFormula, _
summarycalc:=pjCalcFormula, GraphicalIndicators:=False, AutomaticallyRolldownToAssn:=False
ViewApply Name:="resource sheet"
ViewApply Name:="Resource Usage"
End Sub
This was challenging.
John
John-project
Mar 29, 2021Silver Contributor
Okay I've got something that appears to work.
1. In the Resource Usage or Resource Sheet customize the Resource Text1 field with this formula and check the option to "use formula" for task and group summary rows::
IIf([Budget Cost]<>"",round([Number1],1) & "%","")
2. This macro will populate the Resource Number1 field with the desired percentage data
Sub CustomBud()
Dim Den As Single
Dim CFF As String
Den = Round(ActiveProject.ProjectSummaryTask.BudgetCost)
CFF = "iif([budget cost]<>"""",[budget cost]/" & Den & "*100,0)"
CustomFieldSetFormula FieldID:=pjCustomResourceNumber1, Formula:=CFF
CustomFieldPropertiesEx FieldID:=pjCustomResourceNumber1, Attribute:=pjFieldAttributeFormula, _
summarycalc:=pjCalcFormula, GraphicalIndicators:=False, AutomaticallyRolldownToAssn:=False
ViewApply Name:="resource sheet"
ViewApply Name:="Resource Usage"
End Sub
This was challenging.
John
1. In the Resource Usage or Resource Sheet customize the Resource Text1 field with this formula and check the option to "use formula" for task and group summary rows::
IIf([Budget Cost]<>"",round([Number1],1) & "%","")
2. This macro will populate the Resource Number1 field with the desired percentage data
Sub CustomBud()
Dim Den As Single
Dim CFF As String
Den = Round(ActiveProject.ProjectSummaryTask.BudgetCost)
CFF = "iif([budget cost]<>"""",[budget cost]/" & Den & "*100,0)"
CustomFieldSetFormula FieldID:=pjCustomResourceNumber1, Formula:=CFF
CustomFieldPropertiesEx FieldID:=pjCustomResourceNumber1, Attribute:=pjFieldAttributeFormula, _
summarycalc:=pjCalcFormula, GraphicalIndicators:=False, AutomaticallyRolldownToAssn:=False
ViewApply Name:="resource sheet"
ViewApply Name:="Resource Usage"
End Sub
This was challenging.
John
KR
Mar 30, 2021Copper Contributor
Hi John
Thanks a lot for the solution. This awesome! I guess if things don't work the normal way we can always do some programming to solve it. I am not very familiar with VB and I got your code to work in my project file. I need to understand some of the variables that you used which are MS Project dependent. Is there a site I can go to see all possible MS Project's variables that I can use to manipulate data?
One last thing I need to know is that if I want to display all my fixed cost items that are assigned to some Tasks ( fixed cost column) on the same report I attached previously (which is more of a resource level cost information) is that possible? Is there a work around?
Or is it a rule that we cannot combine Resource level data with Task level data period!
Once again thanks a lot for your help. Much appreciated.
Best Rgds
KR
Thanks a lot for the solution. This awesome! I guess if things don't work the normal way we can always do some programming to solve it. I am not very familiar with VB and I got your code to work in my project file. I need to understand some of the variables that you used which are MS Project dependent. Is there a site I can go to see all possible MS Project's variables that I can use to manipulate data?
One last thing I need to know is that if I want to display all my fixed cost items that are assigned to some Tasks ( fixed cost column) on the same report I attached previously (which is more of a resource level cost information) is that possible? Is there a work around?
Or is it a rule that we cannot combine Resource level data with Task level data period!
Once again thanks a lot for your help. Much appreciated.
Best Rgds
KR
- John-projectMar 30, 2021Silver ContributorWhat you really need to understand is the Project Object model. You might look at the following:
https://docs.microsoft.com/en-us/office/client-developer/project/project-home?redirectedfrom=MSDN
To answer your other questions, with VBA you can combine any Project (e.g. project, task, resource, assignment) data to form a report. Depending on thr format sometimes it is possible to create the report in Project, as I did for you in this scenario, but normally I find it much more flexible to export Project data to Excel to create virtually any custom formatted report.
John- KRMar 31, 2021Copper ContributorHi John
Thanks again. Until I hit another problem I will post another discussion. Until then take care.
Cheers!
Stay Safe