From 8b4e2962fcd586ae10c3fd8e6f8c806ac2712ad7 Mon Sep 17 00:00:00 2001 From: KWAMBAI VITALIS Date: Mon, 10 Mar 2025 10:52:44 +0300 Subject: [PATCH 1/3] changes --- instat/dlgThreeVariablePivotTable.Designer.vb | 152 +++++++++--------- instat/dlgThreeVariablePivotTable.vb | 104 ++++-------- 2 files changed, 106 insertions(+), 150 deletions(-) diff --git a/instat/dlgThreeVariablePivotTable.Designer.vb b/instat/dlgThreeVariablePivotTable.Designer.vb index 87bd58aa002..2ef9a7f9731 100644 --- a/instat/dlgThreeVariablePivotTable.Designer.vb +++ b/instat/dlgThreeVariablePivotTable.Designer.vb @@ -37,32 +37,33 @@ Partial Class dlgThreeVariablePivotTable Me.ucrChkIncludeSubTotals = New instat.ucrCheck() Me.ucrReceiverSelectedVariable = New instat.ucrReceiverMultiple() Me.ucrChkSelectedVariable = New instat.ucrCheck() - Me.ucrReceiverInitialColumnFactor = New instat.ucrReceiverSingle() Me.ucrBase = New instat.ucrButtons() Me.ucrSelectorPivot = New instat.ucrSelectorByDataFrameAddRemove() - Me.lblFactorLevels = New System.Windows.Forms.Label() - Me.ucrReceiverFactorLevels = New instat.ucrReceiverSingle() Me.ttFactorLevels = New System.Windows.Forms.ToolTip(Me.components) + Me.ucrReceiverInitialColumnFactor = New instat.ucrReceiverMultiple() + Me.ucrChkFactorsOrder = New instat.ucrCheck() Me.SuspendLayout() ' 'lblInitialColumnFactor ' Me.lblInitialColumnFactor.AutoSize = True Me.lblInitialColumnFactor.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblInitialColumnFactor.Location = New System.Drawing.Point(244, 134) + Me.lblInitialColumnFactor.Location = New System.Drawing.Point(366, 199) + Me.lblInitialColumnFactor.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.lblInitialColumnFactor.Name = "lblInitialColumnFactor" - Me.lblInitialColumnFactor.Size = New System.Drawing.Size(105, 13) + Me.lblInitialColumnFactor.Size = New System.Drawing.Size(180, 20) Me.lblInitialColumnFactor.TabIndex = 54 Me.lblInitialColumnFactor.Tag = "Initial Column Factor:" - Me.lblInitialColumnFactor.Text = "Initial Column Factor:" + Me.lblInitialColumnFactor.Text = "Initial Column Factor(s): " ' 'lblInitialRowFactor ' Me.lblInitialRowFactor.AutoSize = True Me.lblInitialRowFactor.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblInitialRowFactor.Location = New System.Drawing.Point(244, 31) + Me.lblInitialRowFactor.Location = New System.Drawing.Point(366, 46) + Me.lblInitialRowFactor.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.lblInitialRowFactor.Name = "lblInitialRowFactor" - Me.lblInitialRowFactor.Size = New System.Drawing.Size(106, 13) + Me.lblInitialRowFactor.Size = New System.Drawing.Size(158, 20) Me.lblInitialRowFactor.TabIndex = 52 Me.lblInitialRowFactor.Tag = "Initial Row Factor:" Me.lblInitialRowFactor.Text = "Initial Row Factor(s) :" @@ -71,9 +72,10 @@ Partial Class dlgThreeVariablePivotTable ' Me.lblTableChart.AutoSize = True Me.lblTableChart.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblTableChart.Location = New System.Drawing.Point(9, 233) + Me.lblTableChart.Location = New System.Drawing.Point(14, 350) + Me.lblTableChart.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.lblTableChart.Name = "lblTableChart" - Me.lblTableChart.Size = New System.Drawing.Size(73, 13) + Me.lblTableChart.Size = New System.Drawing.Size(103, 20) Me.lblTableChart.TabIndex = 63 Me.lblTableChart.Text = "Table/Chart :" ' @@ -81,9 +83,10 @@ Partial Class dlgThreeVariablePivotTable ' Me.lblSummary.AutoSize = True Me.lblSummary.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblSummary.Location = New System.Drawing.Point(9, 265) + Me.lblSummary.Location = New System.Drawing.Point(14, 398) + Me.lblSummary.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.lblSummary.Name = "lblSummary" - Me.lblSummary.Size = New System.Drawing.Size(59, 13) + Me.lblSummary.Size = New System.Drawing.Size(88, 20) Me.lblSummary.TabIndex = 65 Me.lblSummary.Text = "Summary : " ' @@ -91,9 +94,10 @@ Partial Class dlgThreeVariablePivotTable ' Me.ucrChkNumericVariable.AutoSize = True Me.ucrChkNumericVariable.Checked = False - Me.ucrChkNumericVariable.Location = New System.Drawing.Point(244, 175) + Me.ucrChkNumericVariable.Location = New System.Drawing.Point(366, 350) + Me.ucrChkNumericVariable.Margin = New System.Windows.Forms.Padding(9, 9, 9, 9) Me.ucrChkNumericVariable.Name = "ucrChkNumericVariable" - Me.ucrChkNumericVariable.Size = New System.Drawing.Size(170, 23) + Me.ucrChkNumericVariable.Size = New System.Drawing.Size(255, 34) Me.ucrChkNumericVariable.TabIndex = 67 ' 'ucrInputSummary @@ -102,9 +106,10 @@ Partial Class dlgThreeVariablePivotTable Me.ucrInputSummary.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.ucrInputSummary.GetSetSelectedIndex = -1 Me.ucrInputSummary.IsReadOnly = False - Me.ucrInputSummary.Location = New System.Drawing.Point(82, 265) + Me.ucrInputSummary.Location = New System.Drawing.Point(123, 398) + Me.ucrInputSummary.Margin = New System.Windows.Forms.Padding(14, 14, 14, 14) Me.ucrInputSummary.Name = "ucrInputSummary" - Me.ucrInputSummary.Size = New System.Drawing.Size(104, 21) + Me.ucrInputSummary.Size = New System.Drawing.Size(156, 32) Me.ucrInputSummary.TabIndex = 66 ' 'ucrInputTableChart @@ -113,20 +118,21 @@ Partial Class dlgThreeVariablePivotTable Me.ucrInputTableChart.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.ucrInputTableChart.GetSetSelectedIndex = -1 Me.ucrInputTableChart.IsReadOnly = False - Me.ucrInputTableChart.Location = New System.Drawing.Point(82, 228) + Me.ucrInputTableChart.Location = New System.Drawing.Point(123, 342) + Me.ucrInputTableChart.Margin = New System.Windows.Forms.Padding(14, 14, 14, 14) Me.ucrInputTableChart.Name = "ucrInputTableChart" - Me.ucrInputTableChart.Size = New System.Drawing.Size(104, 21) + Me.ucrInputTableChart.Size = New System.Drawing.Size(156, 32) Me.ucrInputTableChart.TabIndex = 64 ' 'ucrReceiverInitialRowFactors ' Me.ucrReceiverInitialRowFactors.AutoSize = True Me.ucrReceiverInitialRowFactors.frmParent = Me - Me.ucrReceiverInitialRowFactors.Location = New System.Drawing.Point(244, 46) + Me.ucrReceiverInitialRowFactors.Location = New System.Drawing.Point(366, 69) Me.ucrReceiverInitialRowFactors.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverInitialRowFactors.Name = "ucrReceiverInitialRowFactors" Me.ucrReceiverInitialRowFactors.Selector = Nothing - Me.ucrReceiverInitialRowFactors.Size = New System.Drawing.Size(120, 77) + Me.ucrReceiverInitialRowFactors.Size = New System.Drawing.Size(180, 116) Me.ucrReceiverInitialRowFactors.strNcFilePath = "" Me.ucrReceiverInitialRowFactors.TabIndex = 62 Me.ucrReceiverInitialRowFactors.ucrSelector = Nothing @@ -135,11 +141,11 @@ Partial Class dlgThreeVariablePivotTable ' Me.ucrReceiverAdditionalRowFactor.AutoSize = True Me.ucrReceiverAdditionalRowFactor.frmParent = Me - Me.ucrReceiverAdditionalRowFactor.Location = New System.Drawing.Point(244, 202) + Me.ucrReceiverAdditionalRowFactor.Location = New System.Drawing.Point(366, 391) Me.ucrReceiverAdditionalRowFactor.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverAdditionalRowFactor.Name = "ucrReceiverAdditionalRowFactor" Me.ucrReceiverAdditionalRowFactor.Selector = Nothing - Me.ucrReceiverAdditionalRowFactor.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverAdditionalRowFactor.Size = New System.Drawing.Size(180, 30) Me.ucrReceiverAdditionalRowFactor.strNcFilePath = "" Me.ucrReceiverAdditionalRowFactor.TabIndex = 61 Me.ucrReceiverAdditionalRowFactor.ucrSelector = Nothing @@ -147,30 +153,31 @@ Partial Class dlgThreeVariablePivotTable 'ucrSavePivot ' Me.ucrSavePivot.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrSavePivot.Location = New System.Drawing.Point(9, 389) - Me.ucrSavePivot.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrSavePivot.Location = New System.Drawing.Point(14, 584) + Me.ucrSavePivot.Margin = New System.Windows.Forms.Padding(6, 8, 6, 8) Me.ucrSavePivot.Name = "ucrSavePivot" - Me.ucrSavePivot.Size = New System.Drawing.Size(382, 23) + Me.ucrSavePivot.Size = New System.Drawing.Size(573, 34) Me.ucrSavePivot.TabIndex = 59 ' 'ucrChkIncludeSubTotals ' Me.ucrChkIncludeSubTotals.AutoSize = True Me.ucrChkIncludeSubTotals.Checked = False - Me.ucrChkIncludeSubTotals.Location = New System.Drawing.Point(9, 198) + Me.ucrChkIncludeSubTotals.Location = New System.Drawing.Point(14, 297) + Me.ucrChkIncludeSubTotals.Margin = New System.Windows.Forms.Padding(9, 9, 9, 9) Me.ucrChkIncludeSubTotals.Name = "ucrChkIncludeSubTotals" - Me.ucrChkIncludeSubTotals.Size = New System.Drawing.Size(167, 23) + Me.ucrChkIncludeSubTotals.Size = New System.Drawing.Size(250, 34) Me.ucrChkIncludeSubTotals.TabIndex = 58 ' 'ucrReceiverSelectedVariable ' Me.ucrReceiverSelectedVariable.AutoSize = True Me.ucrReceiverSelectedVariable.frmParent = Me - Me.ucrReceiverSelectedVariable.Location = New System.Drawing.Point(244, 257) + Me.ucrReceiverSelectedVariable.Location = New System.Drawing.Point(366, 474) Me.ucrReceiverSelectedVariable.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverSelectedVariable.Name = "ucrReceiverSelectedVariable" Me.ucrReceiverSelectedVariable.Selector = Nothing - Me.ucrReceiverSelectedVariable.Size = New System.Drawing.Size(120, 71) + Me.ucrReceiverSelectedVariable.Size = New System.Drawing.Size(180, 106) Me.ucrReceiverSelectedVariable.strNcFilePath = "" Me.ucrReceiverSelectedVariable.TabIndex = 57 Me.ucrReceiverSelectedVariable.ucrSelector = Nothing @@ -179,31 +186,20 @@ Partial Class dlgThreeVariablePivotTable ' Me.ucrChkSelectedVariable.AutoSize = True Me.ucrChkSelectedVariable.Checked = False - Me.ucrChkSelectedVariable.Location = New System.Drawing.Point(244, 230) + Me.ucrChkSelectedVariable.Location = New System.Drawing.Point(366, 433) + Me.ucrChkSelectedVariable.Margin = New System.Windows.Forms.Padding(9, 9, 9, 9) Me.ucrChkSelectedVariable.Name = "ucrChkSelectedVariable" - Me.ucrChkSelectedVariable.Size = New System.Drawing.Size(135, 23) + Me.ucrChkSelectedVariable.Size = New System.Drawing.Size(202, 34) Me.ucrChkSelectedVariable.TabIndex = 56 ' - 'ucrReceiverInitialColumnFactor - ' - Me.ucrReceiverInitialColumnFactor.AutoSize = True - Me.ucrReceiverInitialColumnFactor.frmParent = Me - Me.ucrReceiverInitialColumnFactor.Location = New System.Drawing.Point(244, 149) - Me.ucrReceiverInitialColumnFactor.Margin = New System.Windows.Forms.Padding(0) - Me.ucrReceiverInitialColumnFactor.Name = "ucrReceiverInitialColumnFactor" - Me.ucrReceiverInitialColumnFactor.Selector = Nothing - Me.ucrReceiverInitialColumnFactor.Size = New System.Drawing.Size(120, 20) - Me.ucrReceiverInitialColumnFactor.strNcFilePath = "" - Me.ucrReceiverInitialColumnFactor.TabIndex = 55 - Me.ucrReceiverInitialColumnFactor.ucrSelector = Nothing - ' 'ucrBase ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(9, 420) + Me.ucrBase.Location = New System.Drawing.Point(14, 630) + Me.ucrBase.Margin = New System.Windows.Forms.Padding(6, 6, 6, 6) Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(408, 52) + Me.ucrBase.Size = New System.Drawing.Size(611, 77) Me.ucrBase.TabIndex = 51 ' 'ucrSelectorPivot @@ -212,44 +208,43 @@ Partial Class dlgThreeVariablePivotTable Me.ucrSelectorPivot.bDropUnusedFilterLevels = False Me.ucrSelectorPivot.bShowHiddenColumns = False Me.ucrSelectorPivot.bUseCurrentFilter = True - Me.ucrSelectorPivot.Location = New System.Drawing.Point(9, 9) + Me.ucrSelectorPivot.Location = New System.Drawing.Point(14, 14) Me.ucrSelectorPivot.Margin = New System.Windows.Forms.Padding(0) Me.ucrSelectorPivot.Name = "ucrSelectorPivot" - Me.ucrSelectorPivot.Size = New System.Drawing.Size(213, 183) + Me.ucrSelectorPivot.Size = New System.Drawing.Size(320, 274) Me.ucrSelectorPivot.TabIndex = 50 ' - 'lblFactorLevels - ' - Me.lblFactorLevels.AutoSize = True - Me.lblFactorLevels.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblFactorLevels.Location = New System.Drawing.Point(244, 339) - Me.lblFactorLevels.Name = "lblFactorLevels" - Me.lblFactorLevels.Size = New System.Drawing.Size(74, 13) - Me.lblFactorLevels.TabIndex = 68 - Me.lblFactorLevels.Tag = "Initial Column Factor:" - Me.lblFactorLevels.Text = "Factor Levels:" - ' - 'ucrReceiverFactorLevels - ' - Me.ucrReceiverFactorLevels.AutoSize = True - Me.ucrReceiverFactorLevels.frmParent = Me - Me.ucrReceiverFactorLevels.Location = New System.Drawing.Point(244, 354) - Me.ucrReceiverFactorLevels.Margin = New System.Windows.Forms.Padding(0) - Me.ucrReceiverFactorLevels.Name = "ucrReceiverFactorLevels" - Me.ucrReceiverFactorLevels.Selector = Nothing - Me.ucrReceiverFactorLevels.Size = New System.Drawing.Size(120, 20) - Me.ucrReceiverFactorLevels.strNcFilePath = "" - Me.ucrReceiverFactorLevels.TabIndex = 69 - Me.ucrReceiverFactorLevels.ucrSelector = Nothing + 'ucrReceiverInitialColumnFactor + ' + Me.ucrReceiverInitialColumnFactor.AutoSize = True + Me.ucrReceiverInitialColumnFactor.frmParent = Me + Me.ucrReceiverInitialColumnFactor.Location = New System.Drawing.Point(366, 223) + Me.ucrReceiverInitialColumnFactor.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverInitialColumnFactor.Name = "ucrReceiverInitialColumnFactor" + Me.ucrReceiverInitialColumnFactor.Selector = Nothing + Me.ucrReceiverInitialColumnFactor.Size = New System.Drawing.Size(180, 116) + Me.ucrReceiverInitialColumnFactor.strNcFilePath = "" + Me.ucrReceiverInitialColumnFactor.TabIndex = 68 + Me.ucrReceiverInitialColumnFactor.ucrSelector = Nothing + ' + 'ucrChkFactorsOrder + ' + Me.ucrChkFactorsOrder.AutoSize = True + Me.ucrChkFactorsOrder.Checked = False + Me.ucrChkFactorsOrder.Location = New System.Drawing.Point(18, 453) + Me.ucrChkFactorsOrder.Margin = New System.Windows.Forms.Padding(9) + Me.ucrChkFactorsOrder.Name = "ucrChkFactorsOrder" + Me.ucrChkFactorsOrder.Size = New System.Drawing.Size(202, 34) + Me.ucrChkFactorsOrder.TabIndex = 69 ' 'dlgThreeVariablePivotTable ' - Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) + Me.AutoScaleDimensions = New System.Drawing.SizeF(144.0!, 144.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True - Me.ClientSize = New System.Drawing.Size(417, 481) - Me.Controls.Add(Me.lblFactorLevels) - Me.Controls.Add(Me.ucrReceiverFactorLevels) + Me.ClientSize = New System.Drawing.Size(626, 722) + Me.Controls.Add(Me.ucrChkFactorsOrder) + Me.Controls.Add(Me.ucrReceiverInitialColumnFactor) Me.Controls.Add(Me.ucrChkNumericVariable) Me.Controls.Add(Me.ucrInputSummary) Me.Controls.Add(Me.lblSummary) @@ -263,10 +258,10 @@ Partial Class dlgThreeVariablePivotTable Me.Controls.Add(Me.ucrChkIncludeSubTotals) Me.Controls.Add(Me.ucrReceiverSelectedVariable) Me.Controls.Add(Me.ucrChkSelectedVariable) - Me.Controls.Add(Me.ucrReceiverInitialColumnFactor) Me.Controls.Add(Me.ucrBase) Me.Controls.Add(Me.ucrSelectorPivot) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4) Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "dlgThreeVariablePivotTable" @@ -284,7 +279,6 @@ Partial Class dlgThreeVariablePivotTable Friend WithEvents ucrChkIncludeSubTotals As ucrCheck Friend WithEvents ucrReceiverSelectedVariable As ucrReceiverMultiple Friend WithEvents ucrChkSelectedVariable As ucrCheck - Friend WithEvents ucrReceiverInitialColumnFactor As ucrReceiverSingle Friend WithEvents ucrBase As ucrButtons Friend WithEvents ucrSelectorPivot As ucrSelectorByDataFrameAddRemove Friend WithEvents ucrReceiverInitialRowFactors As ucrReceiverMultiple @@ -293,7 +287,7 @@ Partial Class dlgThreeVariablePivotTable Friend WithEvents ucrInputSummary As ucrInputComboBox Friend WithEvents lblSummary As Label Friend WithEvents ucrChkNumericVariable As ucrCheck - Friend WithEvents lblFactorLevels As Label - Friend WithEvents ucrReceiverFactorLevels As ucrReceiverSingle Friend WithEvents ttFactorLevels As ToolTip + Friend WithEvents ucrReceiverInitialColumnFactor As ucrReceiverMultiple + Friend WithEvents ucrChkFactorsOrder As ucrCheck End Class \ No newline at end of file diff --git a/instat/dlgThreeVariablePivotTable.vb b/instat/dlgThreeVariablePivotTable.vb index daf52c6c197..f9e1ba9ca75 100644 --- a/instat/dlgThreeVariablePivotTable.vb +++ b/instat/dlgThreeVariablePivotTable.vb @@ -18,11 +18,11 @@ Public Class dlgThreeVariablePivotTable Private bFirstLoad As Boolean = True Private bRcodeSet As Boolean = False Private bReset As Boolean = True - Private clsConcatenateFunction, clsFlattenFunction, - clsLevelsFunction, clsPasteFunction, + Private clsConcatenateFunction, + clsDummyFunction, clsRelevelPasteFunction, clsRPivotTableFunction, clsSelectFunction As New RFunction - Private clsPipeOperator, clsLevelsDollarOperator As New ROperator + Private clsPipeOperator As New ROperator Public enumPivotMode As PivotMode = PivotMode.Prepare Public Enum PivotMode @@ -70,20 +70,14 @@ Public Class dlgThreeVariablePivotTable ucrChkSelectedVariable.AddParameterIsRFunctionCondition(False, "data", True) ucrChkSelectedVariable.AddParameterIsRFunctionCondition(True, "data", False) - - - ucrReceiverFactorLevels.SetParameter(New RParameter("variable", iNewPosition:=1)) - ucrReceiverFactorLevels.SetDataType("factor") - ucrReceiverFactorLevels.SetParameterIsString() - ucrReceiverFactorLevels.bWithQuotes = False - ucrReceiverFactorLevels.Selector = ucrSelectorPivot - ttFactorLevels.SetToolTip(ucrReceiverFactorLevels.txtReceiverSingle, - "Use when default (alphabetical) order of factor levels is inappropriate.") - ucrChkSelectedVariable.SetText("Select Variable(s)") ucrChkSelectedVariable.AddToLinkedControls(ucrReceiverSelectedVariable, {True}, bNewLinkedHideIfParameterMissing:=True) ttSelectedVariable.SetToolTip(ucrChkSelectedVariable.chkCheck, "Include the dataframe if unchecked") + ucrChkFactorsOrder.AddParameterValuesCondition(True, "order", "True") + ucrChkFactorsOrder.AddParameterValuesCondition(False, "order", "False") + ucrChkFactorsOrder.SetText("Factor Labels in Order") + ucrChkIncludeSubTotals.SetText("Subtotals") ucrChkIncludeSubTotals.SetParameter(New RParameter("subtotals", iNewPosition:=3)) ucrChkIncludeSubTotals.SetValuesCheckedAndUnchecked("TRUE", "FALSE") @@ -124,46 +118,20 @@ Public Class dlgThreeVariablePivotTable Private Sub SetDefaults() clsConcatenateFunction = New RFunction - clsFlattenFunction = New RFunction - clsLevelsFunction = New RFunction - clsPasteFunction = New RFunction clsRelevelPasteFunction = New RFunction clsRPivotTableFunction = New RFunction clsSelectFunction = New RFunction - - clsLevelsDollarOperator = New ROperator clsPipeOperator = New ROperator ucrReceiverInitialRowFactors.SetMeAsReceiver() ucrSelectorPivot.Reset() ucrSavePivot.Reset() + clsDummyFunction.AddParameter("order", "False", iPosition:=0) - clsLevelsDollarOperator.SetOperation("$") - - clsLevelsFunction.SetRCommand("levels") - clsLevelsFunction.AddParameter("x", clsROperatorParameter:=clsLevelsDollarOperator, iPosition:=0) - - clsPasteFunction.SetRCommand("paste0") - clsPasteFunction.AddParameter("first_parameter", Chr(34) & "\" & Chr(34) & Chr(34), - iPosition:=0, bIncludeArgumentName:=False) - clsPasteFunction.AddParameter("second_parameter", clsRFunctionParameter:=clsLevelsFunction, - iPosition:=1, bIncludeArgumentName:=False) - clsPasteFunction.AddParameter("third_parameter", Chr(34) & "\" & Chr(34) & "," & Chr(34), - iPosition:=2, bIncludeArgumentName:=False) - - clsFlattenFunction.SetPackageName("stringr") - clsFlattenFunction.SetRCommand("str_flatten") - clsFlattenFunction.AddParameter("string", clsRFunctionParameter:=clsPasteFunction, iPosition:=0) - clsFlattenFunction.SetAssignTo("survey_levels") - - - clsRelevelPasteFunction.SetRCommand("paste0") - clsRelevelPasteFunction.AddParameter("first_paramete", Chr(34) & "function(attr) { var sortAs = $.pivotUtilities.sortAs; return sortAs([" & Chr(34) & ", survey_levels," & Chr(34) & "]); }" & Chr(34), - bIncludeArgumentName:=False, iPosition:=0) + clsRelevelPasteFunction.SetRCommand("return_variable_levels") clsRelevelPasteFunction.SetAssignTo("relevel_variables") - clsConcatenateFunction.SetRCommand("c") clsSelectFunction.SetPackageName("dplyr") @@ -190,16 +158,14 @@ Public Class dlgThreeVariablePivotTable Private Sub SetRCodeForControls(bReset As Boolean) bRcodeSet = False - ucrSelectorPivot.AddAdditionalCodeParameterPair(clsLevelsDollarOperator, ucrSelectorPivot.GetParameter, iAdditionalPairNo:=1) - ucrSelectorPivot.SetRCode(clsPipeOperator, bReset) ucrReceiverInitialColumnFactor.SetRCode(clsRPivotTableFunction, bReset) - ucrReceiverFactorLevels.SetRCode(clsLevelsDollarOperator, bReset) ucrChkNumericVariable.SetRCode(clsRPivotTableFunction, bReset) ucrReceiverInitialRowFactors.SetRCode(clsRPivotTableFunction, bReset) ucrSavePivot.SetRCode(clsRPivotTableFunction, bReset) ucrChkSelectedVariable.SetRCode(clsRPivotTableFunction, bReset) ucrChkIncludeSubTotals.SetRCode(clsRPivotTableFunction, bReset) + ucrChkFactorsOrder.SetRCode(clsDummyFunction, bReset) bRcodeSet = True End Sub @@ -234,6 +200,7 @@ Public Class dlgThreeVariablePivotTable Private Sub ucrSelectorPivot_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorPivot.ControlValueChanged ChangeDataParameterValue() AutofillMode() + SetFactorSortingOrder() clsRPivotTableFunction._strDataFrameNameToAddAssignToObject = ucrSelectorPivot.strCurrentDataFrame End Sub @@ -245,8 +212,8 @@ Public Class dlgThreeVariablePivotTable End If End Sub - Private Sub ReceiversChanged(ucrChangedControls As ucrCore) Handles ucrReceiverInitialColumnFactor.ControlValueChanged, ucrReceiverSelectedVariable.ControlValueChanged, - ucrReceiverInitialRowFactors.ControlValueChanged, ucrReceiverAdditionalRowFactor.ControlValueChanged, ucrReceiverFactorLevels.ControlValueChanged + Private Sub ReceiversChanged(ucrChangedControls As ucrCore) Handles ucrReceiverSelectedVariable.ControlValueChanged, + ucrReceiverInitialRowFactors.ControlValueChanged, ucrReceiverAdditionalRowFactor.ControlValueChanged If Not bRcodeSet Then Exit Sub End If @@ -256,7 +223,6 @@ Public Class dlgThreeVariablePivotTable Dim iPosition As Integer = 0 Dim strColumnVariableName As String = ucrReceiverInitialColumnFactor.GetVariableNames(bWithQuotes:=False) Dim strRowVariableName As String = ucrReceiverAdditionalRowFactor.GetVariableNames(bWithQuotes:=False) - Dim strFactorLevelsVariable As String = ucrReceiverFactorLevels.GetVariableNames(False) clsConcatenateFunction.ClearParameters() If Not ucrReceiverInitialRowFactors.IsEmpty Then CheckForDuplication(lstColumns, ucrReceiverInitialRowFactors, iPosition) @@ -277,21 +243,6 @@ Public Class dlgThreeVariablePivotTable clsConcatenateFunction.AddParameter("col" & iPosition, strRowVariableName, iPosition:=iPosition, bIncludeArgumentName:=False) iPosition += 1 End If - If Not ucrReceiverFactorLevels.IsEmpty AndAlso - Not lstColumns.Contains(strFactorLevelsVariable) Then - clsConcatenateFunction.AddParameter("factor_level", strFactorLevelsVariable, - bIncludeArgumentName:=False, iPosition:=iPosition) - End If - End If - - If ucrChangedControls Is ucrReceiverFactorLevels Then - If ucrReceiverFactorLevels.IsEmpty Then - ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsFlattenFunction) - clsRPivotTableFunction.RemoveParameterByName("sorters") - Else - ucrBase.clsRsyntax.AddToBeforeCodes(clsFlattenFunction, 0) - clsRPivotTableFunction.AddParameter(strParameterName:="sorters", clsRFunctionParameter:=clsRelevelPasteFunction, iPosition:=3) - End If End If End Sub @@ -304,9 +255,6 @@ Public Class dlgThreeVariablePivotTable ucrReceiverInitialColumnFactor.bAutoFill = False - ucrReceiverFactorLevels.SetDataType("factor") - ucrReceiverFactorLevels.bAutoFill = False - ucrReceiverAdditionalRowFactor.SetIncludedDataTypes({"numeric", "Date", "logical"}) ucrReceiverAdditionalRowFactor.bAutoFill = False Case PivotMode.Describe @@ -316,9 +264,6 @@ Public Class dlgThreeVariablePivotTable ucrReceiverInitialColumnFactor.bAutoFill = False - ucrReceiverFactorLevels.SetDataType("factor") - ucrReceiverFactorLevels.bAutoFill = False - ucrReceiverAdditionalRowFactor.SetIncludedDataTypes({"numeric", "Date", "logical"}) ucrReceiverAdditionalRowFactor.bAutoFill = False Case PivotMode.Climatic @@ -344,7 +289,6 @@ Public Class dlgThreeVariablePivotTable End If If Not String.IsNullOrEmpty(strMonthCol) Then - ucrReceiverFactorLevels.Add(strMonthCol, strDataFrame) ucrReceiverInitialColumnFactor.Add(strMonthCol, strDataFrame) End If If ucrSelectorPivot.lstAvailableVariable.Items.Count > 0 AndAlso @@ -357,6 +301,20 @@ Public Class dlgThreeVariablePivotTable End Select End Sub + Private Sub SetFactorSortingOrder() + Dim DataFrame As String = ucrSelectorPivot.strCurrentDataFrame + + If ucrChkFactorsOrder.Checked Then + clsRelevelPasteFunction.AddParameter("data", DataFrame, iPosition:=0, bIncludeArgumentName:=False) + clsRPivotTableFunction.AddParameter("sorters", clsRFunctionParameter:=clsRelevelPasteFunction, iPosition:=3) + clsDummyFunction.AddParameter("order", "True", iPosition:=2) + Else + clsDummyFunction.AddParameter("order", "False", iPosition:=2) + clsRPivotTableFunction.RemoveParameterByName("sorters") + clsRelevelPasteFunction.RemoveParameterByName("data") + End If + End Sub + Private Sub CheckForDuplication(lstNewColumns As List(Of String), ucrNewReceiver As ucrReceiverMultiple, ByRef iNewposition As Integer) For Each strColumn In ucrNewReceiver.GetVariableNamesList(bWithQuotes:=False) If lstNewColumns.Contains(strColumn) Then @@ -368,8 +326,7 @@ Public Class dlgThreeVariablePivotTable Next End Sub - Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverSelectedVariable.ControlContentsChanged, - ucrReceiverInitialColumnFactor.ControlContentsChanged, ucrChkSelectedVariable.ControlContentsChanged, ucrSavePivot.ControlContentsChanged + Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverSelectedVariable.ControlContentsChanged, ucrChkSelectedVariable.ControlContentsChanged, ucrSavePivot.ControlContentsChanged TestOkEnabled() End Sub @@ -382,4 +339,9 @@ Public Class dlgThreeVariablePivotTable ucrReceiverInitialRowFactors.SetMeAsReceiver() End If End Sub + + Private Sub ucrChkFactorsOrder_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkFactorsOrder.ControlValueChanged + SetFactorSortingOrder() + End Sub + End Class \ No newline at end of file From 5d05f79a5ae1c1e71d51128daecae2d00bdd2334 Mon Sep 17 00:00:00 2001 From: KWAMBAI VITALIS Date: Mon, 10 Mar 2025 10:57:31 +0300 Subject: [PATCH 2/3] changes to the code --- instat/translations/rInstatTranslations.db | Bin 8306688 -> 8306688 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/instat/translations/rInstatTranslations.db b/instat/translations/rInstatTranslations.db index e271c4235f81745366604b149ffac1c58cb5e015..de7f248836a58a00b55aa78b891c0a784b89c212 100644 GIT binary patch delta 555 zcmW;C%U6s60EY3tZ$4&Fq1?-@NXaD-7B|ook>N;j596XW1H2it!ykg zv+9qq_D?vrHlAbg+dSu~RQ@I^SZoQ(pIfs*c|lfSg;v6ftYy}6D`};y71l~?l~r#w zSdG?dYmK$mYOKfOXL7u?|^>tzPSh)n^^Gj#Pln0V_qtpr-(US%i2G{k*?2BWHvXv_OfNK4zZ6No=i{kFGWV-F%H-4k zuPRq})H%~N@M)z^EOCxFPh23Hh>Jv!2ocT1CE_x1g=itJ64!`UqKya>?L-H0 zowz}C5;uu1;udk6=qBzEcZnY29uXn#6H%g<=p*`x2gCsJ@Hfm~S;JBGS!USjc2&A9 zvtT%V2bKMtnRI&7hmG!dwy*rhG9#5(-rRJ1{j-jNSSe86D=7WlHd8KN?U5tniItj< zTeNJAOm!Nw->bGMF&UJ&Jd%VA$*??@5qTn`GA83PA(Qe{res=X Date: Mon, 10 Mar 2025 15:30:04 +0300 Subject: [PATCH 3/3] changes to the code --- instat/dlgThreeVariablePivotTable.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgThreeVariablePivotTable.vb b/instat/dlgThreeVariablePivotTable.vb index f9e1ba9ca75..65531e4d713 100644 --- a/instat/dlgThreeVariablePivotTable.vb +++ b/instat/dlgThreeVariablePivotTable.vb @@ -127,7 +127,7 @@ Public Class dlgThreeVariablePivotTable ucrSelectorPivot.Reset() ucrSavePivot.Reset() - clsDummyFunction.AddParameter("order", "False", iPosition:=0) + clsDummyFunction.AddParameter("order", "True", iPosition:=0) clsRelevelPasteFunction.SetRCommand("return_variable_levels") clsRelevelPasteFunction.SetAssignTo("relevel_variables")