QueryLeaf.SetSQLCond method

AutoCAD Map 3D ActiveX

QueryLeaf.SetSQLCond method

Defines an SQL condition.

SetSQLCond( _
 LTNName As String, _
 SQLWhere As String _
 ) As Boolean

Returns True on success.

LTNName

Link Template name.

SQLWhere

SQL Where clause. (Don't include the Where keyword.)

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

The following example defines an SQL condition.

Dim amap As AcadMap

Dim prj As Project

Dim qry As Query

Dim atdr As AttachedDrawing

Dim mainqrybr As QueryBranch

Dim andqrybr As QueryBranch

Dim sqlqrylf As QueryLeaf

Dim qrylf As QueryLeaf

Dim boolVal As Boolean

Dim whereVal as String

Dim strLT as String

 

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 sqlqrylf = andqrybr.Add(kDataCondition, kOperatorOr)

boolVal = qrylf.SetLocationCond(kLocationInside, _

prj.MapUtil.NewLocationAll) 

strLT = "Link template name goes here"

whereVal = "Top = 500 AND Left = 250"

boolVal = sqlqrylf.SetSQLCond("LTname", WhereVal)