IMinutesFieldManager Interface

The Minutes fields manager for an estimate or for a set of fields, that allows for adding, editing and deleting fields for Minutes and sets of fields.
Public Interface IMinutesFieldManager
This language is not supported or no code example is available.
public interface IMinutesFieldManager
This language is not supported or no code example is available.
Name Description
Public property Fields Gets all existing fields.
Public property SetsOfFields Gets all existing sets of fields.
Top
Methods
 
Name Description
Public method AddField(string, string) Creates and adds a new field.
Public method AddSetOfFields(string, string, SetOfFieldType) Creates and adds a new set of fields.
Public method AddSpecialField(SpecialFieldKind, string, string) Adds a special predefined field to the free fields.
Public method ApplyChanges() Applies all changes made with the fields. This includes also changes in fields properties.
Public method DeleteField(string) Deletes a field.
Public method DeleteSetOfFields(string, SetOfFieldType) Deletes a set of fields.
Public method FieldExists(string) Determines whether a field with the specified mnemonic exists.
Public method GetField(string) Gets a field with the specified mnemonic.
Public method GetSetOfFields(string) Gets a set of fields with the specified mnemonic.
Public method LoadLayoutFromFile(EstimateColumnsView, string) Loads the layout of the fields in the minutes view from the specified *.cla file.
Public method MakeFieldsInvisible(IEnumerable<String>, EstimateColumnsView, FieldUserScope) Makes specified fields invisible in a specified view for specified users.
Public method MakeFieldsVisible(IEnumerable<String>, EstimateColumnsView, FieldUserScope) Makes specified fields visible in a specified view for specified users. The fields will be placed at the end of the view.
Public method MakeFieldsVisible(IEnumerable<String>, EstimateColumnsView, FieldUserScope, FieldPlacementPosition, string) Makes specified fields visible and sets their position in a specified view for specified users.
Public method ResetLayoutForAllUsers() Resets the customized layout of the minutes fields for all users in all views, so that they will have the same settings as the administrator, with possible exceptions due to permissions.
Public method SaveLayoutToFile(EstimateColumnsView, string) Saves the layout of the fields in the minutes view to the specified *.cla file.
Public method SetOfFieldsExists(string) Determines whether a set of fields with the specified mnemonic exists.
Public method UpdateSetOfFields(string, SetOfFieldsInformation) Updates an existing set of fields.
Top
Remarks
 

Any changes will not be applied to the estimate until you call ApplyChanges method. You can take this method as the OK button in the Fields Manager. You don't need to call it after each creation of a field or modification of it's properties. But you need to call it, for example, before you want to use a new field as a value of another field's property, e.g. IMinutesField.ReplacementField.

It's recommended to try the operations manually in the Fields Manager UI first.

Example
 

The following example demonstrates various operations with fields. It shows how to create or delete fields and sets of fields, change their properties and visibility.

Try
     Dim fieldMan As Fields.IMinutesFieldManager = Es.GetMinutesFieldManager()
     Dim field As Fields.IMinutesField
    
     ' Cleanup first, if there are some fields from previous tests.
     fieldMan.DeleteField("AAA")
     fieldMan.DeleteField("_AAA")
     fieldMan.DeleteField("BBB")
     fieldMan.DeleteField("CCC")
     fieldMan.DeleteSetOfFields("MAT", SetOfFieldType.Material)
     fieldMan.DeleteSetOfFields("WF", SetOfFieldType.Workforce)
     fieldMan.DeleteSetOfFields("TF", SetOfFieldType.TimeFrame)
     fieldMan.DeleteField("DESCRIPTION_NL_BE")
     fieldMan.DeleteField("UNIT_NL_BE")
     fieldMan.DeleteField("HAS_REFERENCE_IN_BOQ")
     fieldMan.DeleteField("IMPORTED_REFERENCE")
     fieldMan.DeleteField("THROUGHPUT_PACE")
     fieldMan.DeleteField("QUANTITY_FACTOR")
     fieldMan.ApplyChanges()
     ' End of cleanup.
    
     ' Create or modify field "AAA".
     If Not fieldMan.FieldExists("AAA") Then
         field = fieldMan.AddField("AAA", "aaa")
         field.Comment = "aaa comment"
     Else
         field = fieldMan.GetField("AAA")
         field.Formula = "=IF([WPU] <> 0 , 2, 0)"
     End If
     fieldMan.ApplyChanges()
    
     ' Create field "BBB" if not created yet and simulate an exception.
     If Not fieldMan.FieldExists("BBB") Then
         field = fieldMan.AddField("BBB", "")
         Try
             ' This should throw an exception due to the empty field name.
             fieldMan.ApplyChanges()
         Catch exx As Exception
             MessageBox.Show(exx.ToString(), "Example of an exception. We will continue sccessfuly.")
             ' Set the field name to fix the problem.
             field.FieldName = "bbb"
         End Try
         ' The name is OK, no exception should occur now.
         fieldMan.ApplyChanges()
     End If
    
     ' Create and delete field "CCC".
     field = fieldMan.AddField("CCC", "ccc")
     fieldMan.ApplyChanges()
     fieldMan.DeleteField("CCC")
     fieldMan.ApplyChanges()
    
     ' Create the field "CCC" again. It will be used as a replacement field for native "Quantity" field.
     field = fieldMan.AddField("CCC", "ccc")
     fieldMan.ApplyChanges() ' this is needed if you want to make CCC a replacement field in the next step
    
     ' Set CCC as a replacement field for native "Quantity" field.
     field = fieldMan.GetField("Quantity")
     field.Formula = "=1"    'must be a non empty string in order to set ReplacementField
     field.ReplacementField = "CCC"
     fieldMan.ApplyChanges()
    
     ' Add sets of fields.
     Dim sofProblem As String = ""
     If Not fieldMan.AddSetOfFields("MAT", "mat", SetOfFieldType.Material) Then
         sofProblem & = "MAT "
     End If
     If Not fieldMan.AddSetOfFields("WF", "wf", SetOfFieldType.Workforce) Then
         sofProblem & = "WF "
     End If
     If Not fieldMan.AddSetOfFields("TF", "tf", SetOfFieldType.TimeFrame) Then
         sofProblem & = "TF "
     End If
     If sofProblem <> "" Then
         MessageBox.Show("A problem creating the following sets of fields: " & sofProblem)
     End If
     fieldMan.ApplyChanges()
    
     ' Modify some fields in previously created "MAT" set of fields.
     fieldMan = Es.GetMinutesFieldManager("MAT")
     field = fieldMan.GetField("MAT_TotalCost")
     field.ParentName = "custom_parent"
     'field.Formula = "aaa" ' not allowed here
     fieldMan.ApplyChanges()
    
     ' Create some special fields.
     fieldMan = Es.GetMinutesFieldManager()
     field = fieldMan.AddSpecialField(SpecialFieldKind.DescriptionLanguage, "NL-BE", "")
     field = fieldMan.AddSpecialField(SpecialFieldKind.UnitLanguage, "NL-BE", "")
     field = fieldMan.AddSpecialField(SpecialFieldKind.HasReferenceInBoQ)
     field = fieldMan.AddSpecialField(SpecialFieldKind.ImportedReference)
     field = fieldMan.AddSpecialField(SpecialFieldKind.ThroughputPace)
     field = fieldMan.AddSpecialField(SpecialFieldKind.QuantityFactor)
     fieldMan.ApplyChanges()
    
     ' Make the new fields AAA and BBB visible in some views.
     Dim fields As New List(Of String)
     fields.Add("AAA")
     fields.Add("BBB")
     '   Make them visible at the end in Minutes.
     fieldMan.MakeFieldsVisible(fields, EstimateColumnsView.Minutes, FieldUserScope.AllUsers)
     '   Make them visible before Family column in Nomenclatures.
     fieldMan.MakeFieldsVisible(fields, EstimateColumnsView.Nomenclatures, FieldUserScope.AdminAndThisUser,
         FieldPlacementPosition.BeforeGivenField, "Family")
     'fieldMan.MakeFieldsInvisible(fields, EstimateColumnsView.Minutes, FieldUserScope.AllUsers)
     ' Repaint the view to see the changes immediately.
     Es.RepaintCurrentView()
 Catch ex As Exception
     MessageBox.Show(ex.ToString())
 End Try					
This language is not supported or no code example is available.

try
 {
     Qdv.UserApi.Fields.IMinutesFieldManager fieldMan = es.GetMinutesFieldManager();
     Qdv.UserApi.Fields.IMinutesField field;
    
     // Cleanup first, if there are some fields from previous tests.
     fieldMan.DeleteField("AAA");
     fieldMan.DeleteField("_AAA");
     fieldMan.DeleteField("BBB");
     fieldMan.DeleteField("CCC");
     fieldMan.DeleteSetOfFields("MAT", SetOfFieldType.Material);
     fieldMan.DeleteSetOfFields("WF", SetOfFieldType.Workforce);
     fieldMan.DeleteSetOfFields("TF", SetOfFieldType.TimeFrame);
     fieldMan.DeleteField("DESCRIPTION_NL_BE");
     fieldMan.DeleteField("UNIT_NL_BE");
     fieldMan.DeleteField("HAS_REFERENCE_IN_BOQ");
     fieldMan.DeleteField("IMPORTED_REFERENCE");
     fieldMan.DeleteField("THROUGHPUT_PACE");
     fieldMan.DeleteField("QUANTITY_FACTOR");
     fieldMan.ApplyChanges();
     // End of cleanup.
    
     // Create or modify field "AAA".
     if (!fieldMan.FieldExists("AAA"))
     {
         field = fieldMan.AddField("AAA", "aaa");
         field.Comment = "aaa comment";
     }
     else
     {
         field = fieldMan.GetField("AAA");
         field.Formula = "=IF([WPU] <> 0 , 2, 0)";
     }
     fieldMan.ApplyChanges();
    
     // Create field "BBB" if not created yet and simulate an exception.
     if (!fieldMan.FieldExists("BBB"))
     {
         field = fieldMan.AddField("BBB", "");
         try
         {
             // This should throw an exception due to the empty field name.
             fieldMan.ApplyChanges();
         }
         catch (Exception exx)
         {
             MessageBox.Show(exx.ToString(), "Example of an exception. We will continue sccessfuly.");
             // Set the field name to fix the problem.
             field.FieldName = "bbb";
         }
         // The name is OK, no exception should occur now.
         fieldMan.ApplyChanges();
     }
    
     // Create and delete field "CCC".
     field = fieldMan.AddField("CCC", "ccc");
     fieldMan.ApplyChanges();
     fieldMan.DeleteField("CCC");
     fieldMan.ApplyChanges();
    
     // Create the field "CCC" again. It will be used as a replacement field for native "Quantity" field.
     field = fieldMan.AddField("CCC", "ccc");
     fieldMan.ApplyChanges(); // this is needed if you want to make CCC a replacement field in the next step
    
     // Set CCC as a replacement field for native "Quantity" field.
     field = fieldMan.GetField("Quantity");
     field.Formula = "=1";    //must be a non empty string in order to set ReplacementField
     field.ReplacementField = "CCC";
     fieldMan.ApplyChanges();
    
     // Add sets of fields.
     string sofProblem = "";
     if (!fieldMan.AddSetOfFields("MAT", "mat", SetOfFieldType.Material))
     {
         sofProblem += "MAT ";
     }
     if (!fieldMan.AddSetOfFields("WF", "wf", SetOfFieldType.Workforce))
     {
         sofProblem += "WF ";
     }
     if (!fieldMan.AddSetOfFields("TF", "tf", SetOfFieldType.TimeFrame))
     {
         sofProblem += "TF ";
     }
     if (sofProblem != "")
     {
         MessageBox.Show("A problem creating the following sets of fields: " + sofProblem);
     }
     fieldMan.ApplyChanges();
    
     // Modify some fields in previously created "MAT" set of fields.
     fieldMan = es.GetMinutesFieldManager("MAT");
     field = fieldMan.GetField("MAT_TotalCost");
     field.ParentName = "custom_parent";
     //field.Formula = "aaa"; // not allowed here
     fieldMan.ApplyChanges();
    
     // Create some special fields.
     fieldMan = es.GetMinutesFieldManager();
     field = fieldMan.AddSpecialField(SpecialFieldKind.DescriptionLanguage, "NL-BE", "");
     field = fieldMan.AddSpecialField(SpecialFieldKind.UnitLanguage, "NL-BE", "");
     field = fieldMan.AddSpecialField(SpecialFieldKind.HasReferenceInBoQ);
     field = fieldMan.AddSpecialField(SpecialFieldKind.ImportedReference);
     field = fieldMan.AddSpecialField(SpecialFieldKind.ThroughputPace);
     field = fieldMan.AddSpecialField(SpecialFieldKind.QuantityFactor);    
     fieldMan.ApplyChanges();
    
     // Make the new fields AAA and BBB visible in some views.
     var fields = new List<String>();
     fields.Add("AAA");
     fields.Add("BBB");
     //   Make them visible at the end in Minutes.
     fieldMan.MakeFieldsVisible(fields, EstimateColumnsView.Minutes, FieldUserScope.AllUsers);
     //   Make them visible before Family column in Nomenclatures.
     fieldMan.MakeFieldsVisible(fields, EstimateColumnsView.Nomenclatures, FieldUserScope.AdminAndThisUser,
         FieldPlacementPosition.BeforeGivenField, "Family");
     //fieldMan.MakeFieldsInvisible(fields, EstimateColumnsView.Minutes, FieldUserScope.AllUsers);
     // Repaint the view to see the changes immediately.
     es.RepaintCurrentView();
 }
 catch (Exception ex)
 {
     MessageBox.Show(ex.ToString());
 }					
This language is not supported or no code example is available.

Version
 
Available since QDV 7.16.585.

.NET Framework

Supported in: 4.8, 4.7, 4.6, 4.5.2

In this article

Definition