list of parts to change not wrapped in an array if only one row

This commit is contained in:
pt 2020-03-06 00:33:24 -05:00
parent 19021da028
commit 7182502669
3 changed files with 11 additions and 7 deletions

View File

@ -2188,7 +2188,7 @@ Public Function json_from_table(ByRef tbl() As Variant, ByRef array_label As Str
End Function End Function
Public Function json_from_table_zb(ByRef tbl() As Variant, ByRef array_label As String, Optional strip_braces As Boolean) As String Public Function json_from_table_zb(ByRef tbl() As Variant, ByRef array_label As String, ByVal force_array As Boolean, Optional strip_braces As Boolean) As String
Dim ajson As String Dim ajson As String
@ -2234,7 +2234,7 @@ Public Function json_from_table_zb(ByRef tbl() As Variant, ByRef array_label As
'if theres more the one record, include brackets for array 'if theres more the one record, include brackets for array
'if an array_label is given give the array a key and the array become the value 'if an array_label is given give the array a key and the array become the value
'then if the array is labeled with a key it should have braces unless specified otherwise 'then if the array is labeled with a key it should have braces unless specified otherwise
If r > 2 Then If r > 2 Or force_array Then
ajson = "[" & ajson & "]" ajson = "[" & ajson & "]"
If array_label <> "" Then If array_label <> "" Then
ajson = """" & array_label & """:" & ajson ajson = """" & array_label & """:" & ajson

View File

@ -4,7 +4,7 @@ Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} fpvt
ClientHeight = 8445.001 ClientHeight = 8445.001
ClientLeft = 120 ClientLeft = 120
ClientTop = 465 ClientTop = 465
ClientWidth = 8940.001 ClientWidth = 8805.001
OleObjectBlob = "fpvt.frx":0000 OleObjectBlob = "fpvt.frx":0000
StartUpPosition = 1 'CenterOwner StartUpPosition = 1 'CenterOwner
End End
@ -230,7 +230,7 @@ Private Sub cbPLIST_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift
vtable = x.ARRAYp_TransposeVar(vSwap) vtable = x.ARRAYp_TransposeVar(vSwap)
vtable = x.ARRAYp_zerobased_addheader(vtable, "original", "sales", "replace", "fit") vtable = x.ARRAYp_zerobased_addheader(vtable, "original", "sales", "replace", "fit")
vtable = x.ARRAYp_TransposeVar(vtable) vtable = x.ARRAYp_TransposeVar(vtable)
ptable = x.json_from_table_zb(vtable, "rows", False) ptable = x.json_from_table_zb(vtable, "rows", True, False)
Set jswap("swap") = JsonConverter.ParseJson(ptable) Set jswap("swap") = JsonConverter.ParseJson(ptable)
jswap("scenario")("version") = handler.plan jswap("scenario")("version") = handler.plan
@ -270,7 +270,7 @@ Private Sub dbGETSWAP_Click()
vtable = x.ARRAYp_TransposeVar(vSwap) vtable = x.ARRAYp_TransposeVar(vSwap)
vtable = x.ARRAYp_zerobased_addheader(vtable, "original", "sales", "replace", "fit") vtable = x.ARRAYp_zerobased_addheader(vtable, "original", "sales", "replace", "fit")
vtable = x.ARRAYp_TransposeVar(vtable) vtable = x.ARRAYp_TransposeVar(vtable)
ptable = x.json_from_table_zb(vtable, "rows", False) ptable = x.json_from_table_zb(vtable, "rows", True, False)
Set jswap("swap") = JsonConverter.ParseJson(ptable) Set jswap("swap") = JsonConverter.ParseJson(ptable)
jswap("scenario")("version") = handler.plan jswap("scenario")("version") = handler.plan
@ -462,6 +462,10 @@ Private Sub opPlugVol_Click()
End If End If
End Sub End Sub
Private Sub pickSWAP_Change()
End Sub
Private Sub sbpd_Change() Private Sub sbpd_Change()
tbpd.value = sbpd.value tbpd.value = sbpd.value
@ -755,8 +759,8 @@ Private Sub UserForm_Activate()
'--------reset swap tab------------------------------- '--------reset swap tab-------------------------------
lbSWAP.clear lbSWAP.clear
pickSWAP.value = "" pickSWAP.value = ""
pickSWAP.text = "" pickSWAP.text = Mid(sp("package")("basket")(1)("part_descr"), 1, 8)
pickSWAP.list = Application.transpose(Worksheets("mdata").Range("F2:F1672")) pickSWAP.list = Application.transpose(Worksheets("mdata").Range("F2:F1112"))
Call x.frmListBoxHeader(Me.lbSWAPH, Me.lbSWAP, "Original", "Sales", "Replacement", "Fit") Call x.frmListBoxHeader(Me.lbSWAPH, Me.lbSWAP, "Original", "Sales", "Replacement", "Fit")
'---------price volume radio button colors---------- '---------price volume radio button colors----------

BIN
fpvt.frx

Binary file not shown.