IAnalyticReporting.GetAvailableFieldsForDataSource Method

Gets all available WBS fields, minutes fields, global variables and overhead sheet ranges available for analytical reporting.
Function GetAvailableFieldsForDataSource( _ 
ByVal useEightLevelsWhereApplicable As Boolean
) As IEnumerable(Of FieldForQdvFldConfigFile)
This language is not supported or no code example is available.
IEnumerable<FieldForQdvFldConfigFile> GetAvailableFieldsForDataSource( 
bool useEightLevelsWhereApplicable 
)
This language is not supported or no code example is available.

Parameters

useEightLevelsWhereApplicable
bool

The value that will be set in the FieldForQdvFldConfigFile.UseEightLevels property of the returned fields.

Not all WBS and minutes fields can have their FieldForQdvFldConfigFile.UseEightLevels set to true. WBS sum fields cannot apply, and only KindID and list minutes fields apply. The value of useEightLevelsWhereApplicable parameter is ignored for all such WBS and minutes field that are not applicable.

So if you pass true in useEightLevelsWhereApplicable, the returned FieldForQdvFldConfigFile.UseEightLevels values will also indicate which fields are applicable for all levels. You can change the individual values afterwards.

Return Value

IEnumerable<FieldForQdvFldConfigFile>

A collection of FieldForQdvFldConfigFile objects, where each item represents whether a WBS field, a minutes (detailed) field, a global variable or a sheet of the overhead whose named ranges are to be pushed to the data-source.

Example
 

The following macro gets all applicable fields, saves them to a qdvfldconfig file and then generates the data source.

 

Dim aTools As IAnalyticReporting = Es.CurrentVersion.GetAnalyticReportingTools()
 ' Get all available fields for data source and where applicable, set their "All levels" to True.
 Dim fields As IEnumerable(Of FieldForQdvFldConfigFile) = aTools.GetAvailableFieldsForDataSource(useEightLevelsWhereApplicable:=True)
 ' Now you can customize or remove individual fields, if needed.
 
 ' Save the fields configuration into a qdvfldconfig file. This is an optional step.
 Dim collapsed As Boolean = True
 aTools.SaveFieldsForDataSource("C:\test.qdvfldconfig", fields, collapsed)
 
 ' Create the data source.
 Dim dataSourceWorkbook As IWorkbook = aTools.GetDataSource(New List(Of FieldForQdvFldConfigFile)(fields), collapsed)
 
 ' Check the errors, because GetDataSource doesn't throw exceptions.
 If dataSourceWorkbook Is Nothing
     ' an error occurred, get the details
     If Not String.IsNullOrEmpty(Context.QdvManager.Environment.GlobalErrors.GlobalErrorMessage)
         ' The error is reported in GlobalErrorMessage.
         Dim errText As String = Context.QdvManager.Environment.GlobalErrors.GlobalErrorMessage
         MessageBox.Show(errText, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error)
     ElseIf Context.QdvManager.Environment.GlobalErrors.MessageStack.Count > 0
         ' The error(s) is/are reported in MessageStack, display them all.
         Dim errText As String = ""
         For Each err As String In Context.QdvManager.Environment.GlobalErrors.MessageStack
             errText &= err & vbCrLf
         Next
         MessageBox.Show(errText, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error)
     Else
         ' no error details
     End If
 End If					
This language is not supported or no code example is available.

IAnalyticReporting aTools = es.CurrentVersion.GetAnalyticReportingTools();
 // Get all available fields for data source and where applicable, set their "All levels" to True.
 IEnumerable<FieldForQdvFldConfigFile> fields = aTools.GetAvailableFieldsForDataSource(useEightLevelsWhereApplicable: true);
 // Now you can customize or remove individual fields, if needed.
 
 // Save the fields configuration into a qdvfldconfig file. This is an optional step.
 bool collapsed = true;
 aTools.SaveFieldsForDataSource(@"C:\test.qdvfldconfig", fields, collapsed);
 
 // Create the data source.
 IWorkbook dataSourceWorkbook = aTools.GetDataSource(new List<FieldForQdvFldConfigFile>(fields), collapsed);
 
 // Check the errors, because GetDataSource doesn't throw exceptions.
 if (dataSourceWorkbook == null)
 {
     // An error occurred, get the details.
     if (!String.IsNullOrEmpty(context.QdvManager.Environment.GlobalErrors.GlobalErrorMessage))
     {
         // The error is reported in GlobalErrorMessage.
         string errText = context.QdvManager.Environment.GlobalErrors.GlobalErrorMessage;
         MessageBox.Show(errText, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else if (context.QdvManager.Environment.GlobalErrors.MessageStack.Count > 0)
     {
         // The error(s) is/are reported in MessageStack, display them all.
         string errText = "";
         foreach (string err in context.QdvManager.Environment.GlobalErrors.MessageStack)
         {
             errText += err + "\n";
         }
         MessageBox.Show(errText, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     else
     {
         // No error details.
     }
 }					
This language is not supported or no code example is available.

 

Version
 
Available since QDV 7.22.1016.

.NET Framework

Supported in: 4.8, 4.7, 4.6, 4.5.2

In this article

Definition