IEstimate.Anomalies Property

Gets all anomalies added by the last request (with an "Append_Anomaly_List" verb) that was executed in the current macro.
ReadOnly Property Anomalies() As IEnumerable(Of Anomaly)
This language is not supported or no code example is available.
IEnumerable<Anomaly> Anomalies {get;}
This language is not supported or no code example is available.

Property Value

IEnumerable<Anomaly>

All anomalies added by the last executed request (in the current macro).

Remarks
 

One row can have several anomalies. In such a case, a separate Anomaly instance is created for each anomaly.

Remember that this property stores only the anomalies from the request that was executed in the current macro as the last one with the RunQdvRequest method. Each time the RunQdvRequest method is started, the Anomalies property is cleared. If the last request added no anomaly or there was no request called in the current macro, the Anomalies property stays empty.

So this property doesn't serve as a cumulated list of all anomalies added by the requests and by the current macro itself. If you want to keep track of all of them, you need to create such list yourself, see Example section. Then you can display all anomalies with DisplayAnomalies method.

Note, if you execute a request that adds some anomalies, they will be automatically displayed when the request finishes. If you want to suppress this window when you call a request programmatically from a macro, use the specific overload version of the RunQdvRequest method that has showAnomalies parameter for controlling this behavior.

Example
 

The following example macro creates two anomalies and calls a request that also creates some anomalies. The anomalies from the request are joined with the anomalies from the macro. At the end, all anomalies are displayed in the QDV standard "Anomalies" window

' Define a list of all cumulated anomalies created during execution of this macro.                            
 Dim allAnomalies As New List(Of Anomaly)()                                                                     
                                                                                                                
 ' Get a random task and create an anomaly for its line 1                                                       
 Dim taskWithAnomaly As ITask = Es.CurrentVersion.Wbs.Root.SubTasks(0).SubTasks(0)                              
 Dim MyAnomaly As New Anomaly(taskWithAnomaly.HexID, 1, "My anomaly 1")                                         
 allAnomalies.Add(MyAnomaly)                                                                                    
                                                                                                                
 ' Call a request that fills some anomalies, they will be accessible in Es.Anomalies.                           
 ' Suppress displaying anomalies automatically in the request - set the last parameter of RunQdvRequest to False.
 Dim requestError As New MacroExecutionError()                                                                  
 Es.RunQdvRequest("my_request", 1, 1, 1, requestError, False)                                                   
                                                                                                                
 ' Read the anomalies from the last request (stored in Es.Anomalies) and append them to our cumulated anomalies.
 allAnomalies.AddRange(Es.Anomalies)                                                                            
                                                                                                                
 ' Add one more anomaly, for the same line as the first anomaly                                                 
 myAnomaly = New Anomaly(taskWithAnomaly.HexID, 1, "My anomaly 2")                                              
 allAnomalies.Add(MyAnomaly)                                                                                    
                                                                                                                
 ' Now display all anomalies                                                                                    
 Es.DisplayAnomalies(allAnomalies)					
This language is not supported or no code example is available.

Version
 
Available since QDV 7.16.587.

.NET Framework

Supported in: 4.8, 4.7, 4.6, 4.5.2

In this article

Definition