Showing results for 
Search instead for 
Do you mean 

Using SQL to Query the Rules, Project, and Component Databases

by Community Manager Community Manager on ‎04-18-2016 11:32 AM

These are connections to the Rules, Project and Component databases used to access data within these databases via a formula:


  g_RulesData.ExecuteSQL( SQLstring )

  g_ProjectData.ExecuteSQL( SQLstring )

  g_ComponentData.ExecuteSQL( SQLstring )


Here is an example of code that would be placed in the custom.VB to access data in the "partValue" column in the Component database of an application



          Dim strSQL As String

          strSQL = "SELECT partValue FROM AppsDimensions WHERE partPlating = '" & strPlatingType & "'"


          '-- Execute the SQL against the component database

          Dim ds As DataSet = g_ComponentData.ExecuteSQL(strSQL)


          '-- Make sure at least 1 result set was returned

          If ds.Tables.Count > 0 Then


                   '-- Loop though each row in the first result set

                   For Each dr As DataRow In ds.Tables(0).Rows


                              '-- Access a column value by name

                              result = CDbl(dr.Item("partValue"))


          End If


Catch ex As Exception

          g_ObjectManager.LogError("getPartValueSQL", String.Format("Error: ""{0}"" .", ex.Message), MsgBoxStyle.Critical)

End Try