IAnalyticReporting.SaveFieldsForDataSource Method
Sub SaveFieldsForDataSource( _
ByVal QdvFldConfigFilePath As String, _
ByVal fields As IEnumerable(Of FieldForQdvFldConfigFile), _
ByVal groupsAreCollapsed As Boolean _
)
This language is not supported or no code example is available.
void SaveFieldsForDataSource(
string QdvFldConfigFilePath,
IEnumerable<FieldForQdvFldConfigFile> fields,
bool groupsAreCollapsed
)
This language is not supported or no code example is available.
Parameters
- QdvFldConfigFilePath
- string
The full path to the .QDVFldConfig file.
- fields
- IEnumerable<FieldForQdvFldConfigFile>
A list 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.
- groupsAreCollapsed
- bool
true when groups must be collapsed; otherwise false.
Exception type | Condition |
---|---|
An IO error occurs. |
|
An error occurred during serialization. |
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.
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.
The following macro gets all applicable fields, saves them to a qdvfldconfig file and then generates the data source.
Available since QDV 7.22.1016.