QueryLeaf.SetDataCond method

AutoCAD Map 3D ActiveX

QueryLeaf.SetDataCond method

Defines a data condition.

SetDataCond( _
 DataType As EDataQueryType, _
 CondOperation As EConditionOperator, _
 Table As String, _
 Field As String, _
 Value As Variant _
 ) As Boolean

Returns True on success.

DataType

The EDataQueryType constant that specifies the kind of data to query.

CondOperation

The EConditionOperator constant that specifies the comparison operator for the query. Note The only valid operator in a string context is kCondEq.

Table

A data source: block name, link template, or RegApp.

Field

A field value for the data type:

Attribute tag of a block
Column name of an object data table
Object data field name
Extended entity data field name

Value

A value in the data source to query.

Note Call this method only if the QueryLeaf object's Type property is kDataCondition.

The following example performs a query for data less than the value in a table Water_Bodies, in a field called Avg_Depth with a value of 10.

Dim amap As AcadMap
Dim prj As Project
Dim qry As Query
Dim mainqrybr As QueryBranch
Dim andqrybr As QueryBranch
Dim dataqrylf As QueryLeaf
Dim qrylf As QueryLeaf
Dim boolVal As Boolean
Dim atdr As AttachedDrawing

Set amap = ThisDrawing.Application. _
   GetInterfaceObject("AutoCADMap.Application") 
Set prj = amap.Projects(ThisDrawing)
Set qry = prj.CurrQuery
Set atdr = prj.DrawingSet.Add("MAPTUT:\\citymap7.dwg")
boolVal = qry.Clear
Set mainqrybr = qry.QueryBranch
Set qrylf = mainqrybr.Add( _
   kLocationCondition, _ 
   kOperatorAnd)
Set andqrybr = mainqrybr.Add( _
   kQueryBranch, _ 
   kOperatorAnd)
Set dataqrylf = andqrybr.Add( _
   kDataCondition, _ 
   kOperatorOr)
boolVal = qrylf.SetLocationCond( _
   kLocationInside, _
   prj.MapUtil.NewLocationAll) 
boolVal = dataqrylf.SetDataCond( _
   kDataIRD, _ 
   kCondLT, _ 
   "Water_Bodies", _ 
   "Avg_Depth", _ 
   10)