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
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
@ -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 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
If r > 2 Then
If r > 2 Or force_array Then
ajson = "[" & ajson & "]"
If array_label <> "" Then
ajson = """" & array_label & """:" & ajson

View File

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

BIN
fpvt.frx

Binary file not shown.