accomodate new sql builder parameters, and test for presence of price sheet

This commit is contained in:
Paul Trowbridge 2020-01-29 13:31:32 -05:00
parent 99905a9341
commit 4b6d0c744d

46
FL.bas
View File

@ -16,8 +16,6 @@ Public Enum ColorTier
End Enum End Enum
Sub Determine_Active_Range() Sub Determine_Active_Range()
Dim r As Range Dim r As Range
@ -614,13 +612,43 @@ Sub markdown_whole_sheet()
End Sub End Sub
Sub sql_from_range() Sub sql_from_range_db2_qh()
Dim x As New TheBigOne Dim x As New TheBigOne
Dim wapi As New Windows_API Dim wapi As New Windows_API
Dim r() As String Dim r() As String
Selection.CurrentRegion.Select Selection.CurrentRegion.Select
Call wapi.ClipBoard_SetData(x.SQLp_build_sql_values(x.ARRAYp_get_range_string(Selection), True, True, Db2)) Call wapi.ClipBoard_SetData(x.SQLp_build_sql_values(x.ARRAYp_get_range_string(Selection), True, True, Db2, True))
End Sub
Sub sql_from_range_db2_noqh()
Dim x As New TheBigOne
Dim wapi As New Windows_API
Dim r() As String
Selection.CurrentRegion.Select
Call wapi.ClipBoard_SetData(x.SQLp_build_sql_values(x.ARRAYp_get_range_string(Selection), True, True, Db2, False))
End Sub
Sub sql_from_range_pg_qh()
Dim x As New TheBigOne
Dim wapi As New Windows_API
Dim r() As String
Selection.CurrentRegion.Select
Call wapi.ClipBoard_SetData(x.SQLp_build_sql_values(x.ARRAYp_get_range_string(Selection), True, True, PostgreSQL, True))
End Sub
Sub sql_from_range_pg_noqh()
Dim x As New TheBigOne
Dim wapi As New Windows_API
Dim r() As String
Selection.CurrentRegion.Select
Call wapi.ClipBoard_SetData(x.SQLp_build_sql_values(x.ARRAYp_get_range_string(Selection), True, True, PostgreSQL, False))
End Sub End Sub
@ -822,7 +850,7 @@ Sub extract_price_matrix()
'-------------------------prepare sql to upload--------------------------------------------------------------- '-------------------------prepare sql to upload---------------------------------------------------------------
sql = x.SQLp_build_sql_values(unp, False, True, Db2) sql = x.SQLp_build_sql_values(unp, False, True, Db2, False)
sql = "DECLARE GLOBAL TEMPORARY TABLE session.plbuild AS (" & sql & ") WITH DATA" sql = "DECLARE GLOBAL TEMPORARY TABLE session.plbuild AS (" & sql & ") WITH DATA"
Call wapi.ClipBoard_SetData(sql) Call wapi.ClipBoard_SetData(sql)
@ -918,15 +946,23 @@ Sub go_to_price_issue()
Dim trow As Long Dim trow As Long
Dim tcol As Long Dim tcol As Long
Dim i As Long Dim i As Long
Dim has_Pricesheet As Boolean
has_Pricesheet = False
For Each ws In Application.Worksheets For Each ws In Application.Worksheets
For Each cp In ws.CustomProperties For Each cp In ws.CustomProperties
If cp.Name = "spec_name" And cp.value = "price_list" Then If cp.Name = "spec_name" And cp.value = "price_list" Then
Set price_sheet = ws Set price_sheet = ws
has_Pricesheet = True
End If End If
Next cp Next cp
Next ws Next ws
If Not has_Pricesheet Then
MsgBox ("no price sheet found")
Exit Sub
End If
Set orig = Application.Selection Set orig = Application.Selection
Selection.CurrentRegion.Select Selection.CurrentRegion.Select