diff --git a/instat/dlgClimSoft.Designer.vb b/instat/dlgClimSoft.Designer.vb
index 18e11098e6a..1c5b32afda8 100644
--- a/instat/dlgClimSoft.Designer.vb
+++ b/instat/dlgClimSoft.Designer.vb
@@ -67,6 +67,7 @@ Partial Class dlgClimSoft
Me.ucrReceiverMultipleElements = New instat.ucrReceiverMultiple()
Me.ucrReceiverMultipleStations = New instat.ucrReceiverMultiple()
Me.ucrBase = New instat.ucrButtons()
+ Me.ucrChKUnstackData = New instat.ucrCheck()
Me.SuspendLayout()
'
'btnConnection
@@ -126,7 +127,7 @@ Partial Class dlgClimSoft
'
Me.ucrChkDataDate.AutoSize = True
Me.ucrChkDataDate.Checked = False
- Me.ucrChkDataDate.Location = New System.Drawing.Point(9, 289)
+ Me.ucrChkDataDate.Location = New System.Drawing.Point(9, 317)
Me.ucrChkDataDate.Margin = New System.Windows.Forms.Padding(6, 8, 6, 8)
Me.ucrChkDataDate.Name = "ucrChkDataDate"
Me.ucrChkDataDate.Size = New System.Drawing.Size(169, 23)
@@ -138,7 +139,7 @@ Partial Class dlgClimSoft
Me.ucrDtpEndDataDate.AutoSize = True
Me.ucrDtpEndDataDate.DateValue = New Date(2021, 5, 18, 16, 45, 8, 379)
Me.ucrDtpEndDataDate.Format = "dd MMM yyyy"
- Me.ucrDtpEndDataDate.Location = New System.Drawing.Point(156, 312)
+ Me.ucrDtpEndDataDate.Location = New System.Drawing.Point(156, 340)
Me.ucrDtpEndDataDate.Margin = New System.Windows.Forms.Padding(6, 8, 6, 8)
Me.ucrDtpEndDataDate.MaxDate = New Date(9998, 12, 31, 0, 0, 0, 0)
Me.ucrDtpEndDataDate.MinDate = New Date(1753, 1, 1, 0, 0, 0, 0)
@@ -152,7 +153,7 @@ Partial Class dlgClimSoft
Me.ucrDtpStartDataDate.AutoSize = True
Me.ucrDtpStartDataDate.DateValue = New Date(2021, 5, 18, 16, 45, 8, 408)
Me.ucrDtpStartDataDate.Format = "dd MMM yyyy"
- Me.ucrDtpStartDataDate.Location = New System.Drawing.Point(23, 313)
+ Me.ucrDtpStartDataDate.Location = New System.Drawing.Point(23, 341)
Me.ucrDtpStartDataDate.Margin = New System.Windows.Forms.Padding(6, 8, 6, 8)
Me.ucrDtpStartDataDate.MaxDate = New Date(9998, 12, 31, 0, 0, 0, 0)
Me.ucrDtpStartDataDate.MinDate = New Date(1753, 1, 1, 0, 0, 0, 0)
@@ -187,7 +188,7 @@ Partial Class dlgClimSoft
'
Me.lblToDataDate.AutoSize = True
Me.lblToDataDate.ImeMode = System.Windows.Forms.ImeMode.NoControl
- Me.lblToDataDate.Location = New System.Drawing.Point(130, 315)
+ Me.lblToDataDate.Location = New System.Drawing.Point(130, 345)
Me.lblToDataDate.Name = "lblToDataDate"
Me.lblToDataDate.Size = New System.Drawing.Size(20, 13)
Me.lblToDataDate.TabIndex = 20
@@ -218,7 +219,7 @@ Partial Class dlgClimSoft
'btnCheckRecords
'
Me.btnCheckRecords.ImeMode = System.Windows.Forms.ImeMode.NoControl
- Me.btnCheckRecords.Location = New System.Drawing.Point(6, 376)
+ Me.btnCheckRecords.Location = New System.Drawing.Point(6, 404)
Me.btnCheckRecords.Name = "btnCheckRecords"
Me.btnCheckRecords.Size = New System.Drawing.Size(139, 23)
Me.btnCheckRecords.TabIndex = 28
@@ -230,7 +231,7 @@ Partial Class dlgClimSoft
Me.lblRecordsNum.AutoSize = True
Me.lblRecordsNum.ForeColor = System.Drawing.Color.Red
Me.lblRecordsNum.ImeMode = System.Windows.Forms.ImeMode.NoControl
- Me.lblRecordsNum.Location = New System.Drawing.Point(156, 380)
+ Me.lblRecordsNum.Location = New System.Drawing.Point(156, 408)
Me.lblRecordsNum.Name = "lblRecordsNum"
Me.lblRecordsNum.Size = New System.Drawing.Size(64, 13)
Me.lblRecordsNum.TabIndex = 29
@@ -239,11 +240,11 @@ Partial Class dlgClimSoft
'btnMoreOptions
'
Me.btnMoreOptions.ImeMode = System.Windows.Forms.ImeMode.NoControl
- Me.btnMoreOptions.Location = New System.Drawing.Point(5, 345)
+ Me.btnMoreOptions.Location = New System.Drawing.Point(5, 373)
Me.btnMoreOptions.Name = "btnMoreOptions"
Me.btnMoreOptions.Size = New System.Drawing.Size(139, 23)
Me.btnMoreOptions.TabIndex = 31
- Me.btnMoreOptions.Text = "More options"
+ Me.btnMoreOptions.Text = "Options"
Me.btnMoreOptions.UseVisualStyleBackColor = True
'
'rdoMetadata
@@ -378,18 +379,30 @@ Partial Class dlgClimSoft
'
Me.ucrBase.AutoSize = True
Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink
- Me.ucrBase.Location = New System.Drawing.Point(9, 407)
+ Me.ucrBase.Location = New System.Drawing.Point(9, 444)
Me.ucrBase.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.ucrBase.Name = "ucrBase"
Me.ucrBase.Size = New System.Drawing.Size(408, 52)
Me.ucrBase.TabIndex = 14
'
+ 'ucrChKUnstackData
+ '
+ Me.ucrChKUnstackData.AutoSize = True
+ Me.ucrChKUnstackData.Checked = False
+ Me.ucrChKUnstackData.Location = New System.Drawing.Point(8, 289)
+ Me.ucrChKUnstackData.Margin = New System.Windows.Forms.Padding(6, 8, 6, 8)
+ Me.ucrChKUnstackData.Name = "ucrChKUnstackData"
+ Me.ucrChKUnstackData.Size = New System.Drawing.Size(169, 23)
+ Me.ucrChKUnstackData.TabIndex = 38
+ Me.ttClimsoft.SetToolTip(Me.ucrChKUnstackData, "Select Observation Data Date Range")
+ '
'dlgClimSoft
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi
Me.AutoSize = True
- Me.ClientSize = New System.Drawing.Size(438, 464)
+ Me.ClientSize = New System.Drawing.Size(438, 505)
+ Me.Controls.Add(Me.ucrChKUnstackData)
Me.Controls.Add(Me.ucrChkImportFlagsMetadata)
Me.Controls.Add(Me.ucrChkImportElementsMetadata)
Me.Controls.Add(Me.ucrChkImportStationsMetadata)
@@ -456,4 +469,5 @@ Partial Class dlgClimSoft
Friend WithEvents ucrChkImportElementsMetadata As ucrCheck
Friend WithEvents ucrChkImportStationsMetadata As ucrCheck
Friend WithEvents ucrChkImportFlagsMetadata As ucrCheck
+ Friend WithEvents ucrChKUnstackData As ucrCheck
End Class
\ No newline at end of file
diff --git a/instat/dlgClimSoft.vb b/instat/dlgClimSoft.vb
index c6113117e85..b448a049de6 100644
--- a/instat/dlgClimSoft.vb
+++ b/instat/dlgClimSoft.vb
@@ -109,9 +109,16 @@ Public Class dlgClimSoft
ucrCboQCStatus.SetLinkedDisplayControl(lblSelectQCStatus)
'---------------------------------------
+ 'Unstack data
+ '---------------------------------------
+ ucrChKUnstackData.SetText("Unstack Data")
+ ucrChKUnstackData.SetParameter(New RParameter("unstack_data", 13))
+ ucrChKUnstackData.SetRDefault("FALSE")
+ '---------------------------------------
+
'date range
'---------------------------------------
- ucrChkDataDate.SetText("Select Data Date")
+ ucrChkDataDate.SetText("Select Dates")
ucrDtpStartDataDate.SetParameter(New RParameter("start_date", 6))
ucrDtpStartDataDate.SetParameterIsRDate()
@@ -147,7 +154,7 @@ Public Class dlgClimSoft
ucrPnlOptions.AddFunctionNamesCondition(rdoMetadata, frmMain.clsRLink.strInstatDataObject & "$import_climsoft_metadata")
- ucrPnlOptions.AddToLinkedControls({ucrCboTable, ucrCboQCStatus, ucrSelectorForClimSoft, ucrReceiverMultipleStations, ucrReceiverMultipleElements, ucrCboStations, ucrCboElements, ucrChkDataDate},
+ ucrPnlOptions.AddToLinkedControls({ucrCboTable, ucrCboQCStatus, ucrSelectorForClimSoft, ucrReceiverMultipleStations, ucrReceiverMultipleElements, ucrCboStations, ucrCboElements, ucrChkDataDate, ucrChKUnstackData},
{rdoData}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True)
ucrPnlOptions.AddToLinkedControls({ucrChkImportStationsMetadata, ucrChkImportElementsMetadata, ucrChkImportFlagsMetadata},
{rdoMetadata}, bNewLinkedAddRemoveParameter:=False, bNewLinkedHideIfParameterMissing:=True)
@@ -163,7 +170,7 @@ Public Class dlgClimSoft
'data command
'---------------------------------------
clsRImportClimsoftData.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$import_climsoft_data")
- clsRImportClimsoftData.AddParameter(strParameterName:="table", strParameterValue:=Chr(34) & "observationinitial" & Chr(34), iPosition:=0)
+ clsRImportClimsoftData.AddParameter(strParameterName:="table", strParameterValue:=Chr(34) & "observationfinal" & Chr(34), iPosition:=0)
clsRImportClimsoftData.AddParameter(strParameterName:="station_filter_column", strParameterValue:=Chr(34) & "stationId" & Chr(34), iPosition:=1)
clsRImportClimsoftData.AddParameter(strParameterName:="element_filter_column", strParameterValue:=Chr(34) & "elementId" & Chr(34), iPosition:=3)
'---------------------------------------
@@ -193,6 +200,8 @@ Public Class dlgClimSoft
ucrCboTable.SetRCode(clsRImportClimsoftData, bReset)
+ ucrChKUnstackData.SetRCode(clsRImportClimsoftData, bReset)
+
ucrCboQCStatus.SetRCode(clsRImportClimsoftData, bReset)
ucrDtpStartDataDate.SetRCode(clsRImportClimsoftData, bReset)
diff --git a/instat/instat.vbproj b/instat/instat.vbproj
index ac9774d99bb..7670f979bf2 100644
--- a/instat/instat.vbproj
+++ b/instat/instat.vbproj
@@ -3206,6 +3206,9 @@
dlgThreeVariablePivotTable.vb
+
+ sdgClimsoft.vb
+
sdgDefineAnnualRainfall.vb
diff --git a/instat/sdgClimsoft.Designer.vb b/instat/sdgClimsoft.Designer.vb
index 0dc1103611d..66902102eb5 100644
--- a/instat/sdgClimsoft.Designer.vb
+++ b/instat/sdgClimsoft.Designer.vb
@@ -24,10 +24,10 @@ Partial Class sdgClimsoft
Private Sub InitializeComponent()
Me.tbpTitles = New System.Windows.Forms.TabPage()
Me.grpMetadataToImport = New System.Windows.Forms.GroupBox()
+ Me.ucrChkImportElementsMetadata = New instat.ucrCheck()
+ Me.ucrChkImportStationsMetadata = New instat.ucrCheck()
Me.tbColumns = New System.Windows.Forms.TabPage()
Me.grpColumnsToInclude = New System.Windows.Forms.GroupBox()
- Me.tbpMoreOptions = New System.Windows.Forms.TabControl()
- Me.ucrBaseSubdialog = New instat.ucrButtonsSubdialogue()
Me.ucrChkIncludeQCLog = New instat.ucrCheck()
Me.ucrChkIncludeCapturedBy = New instat.ucrCheck()
Me.ucrChkIncludeQCStatus = New instat.ucrCheck()
@@ -37,8 +37,12 @@ Partial Class sdgClimsoft
Me.ucrChkIncludeAquistion = New instat.ucrCheck()
Me.ucrChkIncludeEntryForm = New instat.ucrCheck()
Me.ucrChkIncludeFlag = New instat.ucrCheck()
- Me.ucrChkImportElementsMetadata = New instat.ucrCheck()
- Me.ucrChkImportStationsMetadata = New instat.ucrCheck()
+ Me.tbpMoreOptions = New System.Windows.Forms.TabControl()
+ Me.ucrBaseSubdialog = New instat.ucrButtonsSubdialogue()
+ Me.ucrChkIncludeElementId = New instat.ucrCheck()
+ Me.ucrChkIncludeStationId = New instat.ucrCheck()
+ Me.ucrChkIncludeDateTime = New instat.ucrCheck()
+ Me.ucrChkIncludeElementName = New instat.ucrCheck()
Me.tbpTitles.SuspendLayout()
Me.grpMetadataToImport.SuspendLayout()
Me.tbColumns.SuspendLayout()
@@ -52,7 +56,7 @@ Partial Class sdgClimsoft
Me.tbpTitles.Location = New System.Drawing.Point(4, 22)
Me.tbpTitles.Name = "tbpTitles"
Me.tbpTitles.Padding = New System.Windows.Forms.Padding(3)
- Me.tbpTitles.Size = New System.Drawing.Size(409, 281)
+ Me.tbpTitles.Size = New System.Drawing.Size(409, 303)
Me.tbpTitles.TabIndex = 2
Me.tbpTitles.Tag = ""
Me.tbpTitles.Text = "Metadata"
@@ -69,13 +73,31 @@ Partial Class sdgClimsoft
Me.grpMetadataToImport.TabStop = False
Me.grpMetadataToImport.Text = "Metadata to Import"
'
+ 'ucrChkImportElementsMetadata
+ '
+ Me.ucrChkImportElementsMetadata.AutoSize = True
+ Me.ucrChkImportElementsMetadata.Checked = False
+ Me.ucrChkImportElementsMetadata.Location = New System.Drawing.Point(0, 46)
+ Me.ucrChkImportElementsMetadata.Name = "ucrChkImportElementsMetadata"
+ Me.ucrChkImportElementsMetadata.Size = New System.Drawing.Size(315, 23)
+ Me.ucrChkImportElementsMetadata.TabIndex = 20
+ '
+ 'ucrChkImportStationsMetadata
+ '
+ Me.ucrChkImportStationsMetadata.AutoSize = True
+ Me.ucrChkImportStationsMetadata.Checked = False
+ Me.ucrChkImportStationsMetadata.Location = New System.Drawing.Point(0, 22)
+ Me.ucrChkImportStationsMetadata.Name = "ucrChkImportStationsMetadata"
+ Me.ucrChkImportStationsMetadata.Size = New System.Drawing.Size(315, 23)
+ Me.ucrChkImportStationsMetadata.TabIndex = 19
+ '
'tbColumns
'
Me.tbColumns.Controls.Add(Me.grpColumnsToInclude)
Me.tbColumns.Location = New System.Drawing.Point(4, 22)
Me.tbColumns.Name = "tbColumns"
Me.tbColumns.Padding = New System.Windows.Forms.Padding(3)
- Me.tbColumns.Size = New System.Drawing.Size(409, 281)
+ Me.tbColumns.Size = New System.Drawing.Size(409, 367)
Me.tbColumns.TabIndex = 3
Me.tbColumns.Tag = ""
Me.tbColumns.Text = "Data"
@@ -83,6 +105,10 @@ Partial Class sdgClimsoft
'
'grpColumnsToInclude
'
+ Me.grpColumnsToInclude.Controls.Add(Me.ucrChkIncludeElementName)
+ Me.grpColumnsToInclude.Controls.Add(Me.ucrChkIncludeDateTime)
+ Me.grpColumnsToInclude.Controls.Add(Me.ucrChkIncludeElementId)
+ Me.grpColumnsToInclude.Controls.Add(Me.ucrChkIncludeStationId)
Me.grpColumnsToInclude.Controls.Add(Me.ucrChkIncludeQCLog)
Me.grpColumnsToInclude.Controls.Add(Me.ucrChkIncludeCapturedBy)
Me.grpColumnsToInclude.Controls.Add(Me.ucrChkIncludeQCStatus)
@@ -94,34 +120,16 @@ Partial Class sdgClimsoft
Me.grpColumnsToInclude.Controls.Add(Me.ucrChkIncludeFlag)
Me.grpColumnsToInclude.Location = New System.Drawing.Point(8, 10)
Me.grpColumnsToInclude.Name = "grpColumnsToInclude"
- Me.grpColumnsToInclude.Size = New System.Drawing.Size(394, 265)
+ Me.grpColumnsToInclude.Size = New System.Drawing.Size(394, 351)
Me.grpColumnsToInclude.TabIndex = 32
Me.grpColumnsToInclude.TabStop = False
Me.grpColumnsToInclude.Text = "Columns to Include"
'
- 'tbpMoreOptions
- '
- Me.tbpMoreOptions.Controls.Add(Me.tbColumns)
- Me.tbpMoreOptions.Controls.Add(Me.tbpTitles)
- Me.tbpMoreOptions.Location = New System.Drawing.Point(-1, 4)
- Me.tbpMoreOptions.Name = "tbpMoreOptions"
- Me.tbpMoreOptions.SelectedIndex = 0
- Me.tbpMoreOptions.Size = New System.Drawing.Size(417, 307)
- Me.tbpMoreOptions.TabIndex = 2
- '
- 'ucrBaseSubdialog
- '
- Me.ucrBaseSubdialog.AutoSize = True
- Me.ucrBaseSubdialog.Location = New System.Drawing.Point(88, 315)
- Me.ucrBaseSubdialog.Name = "ucrBaseSubdialog"
- Me.ucrBaseSubdialog.Size = New System.Drawing.Size(224, 29)
- Me.ucrBaseSubdialog.TabIndex = 3
- '
'ucrChkIncludeQCLog
'
Me.ucrChkIncludeQCLog.AutoSize = True
- Me.ucrChkIncludeQCLog.Checked = True
- Me.ucrChkIncludeQCLog.Location = New System.Drawing.Point(6, 186)
+ Me.ucrChkIncludeQCLog.Checked = False
+ Me.ucrChkIncludeQCLog.Location = New System.Drawing.Point(6, 294)
Me.ucrChkIncludeQCLog.Name = "ucrChkIncludeQCLog"
Me.ucrChkIncludeQCLog.Size = New System.Drawing.Size(295, 23)
Me.ucrChkIncludeQCLog.TabIndex = 21
@@ -129,8 +137,8 @@ Partial Class sdgClimsoft
'ucrChkIncludeCapturedBy
'
Me.ucrChkIncludeCapturedBy.AutoSize = True
- Me.ucrChkIncludeCapturedBy.Checked = True
- Me.ucrChkIncludeCapturedBy.Location = New System.Drawing.Point(6, 138)
+ Me.ucrChkIncludeCapturedBy.Checked = False
+ Me.ucrChkIncludeCapturedBy.Location = New System.Drawing.Point(6, 243)
Me.ucrChkIncludeCapturedBy.Name = "ucrChkIncludeCapturedBy"
Me.ucrChkIncludeCapturedBy.Size = New System.Drawing.Size(295, 23)
Me.ucrChkIncludeCapturedBy.TabIndex = 20
@@ -138,8 +146,8 @@ Partial Class sdgClimsoft
'ucrChkIncludeQCStatus
'
Me.ucrChkIncludeQCStatus.AutoSize = True
- Me.ucrChkIncludeQCStatus.Checked = True
- Me.ucrChkIncludeQCStatus.Location = New System.Drawing.Point(6, 162)
+ Me.ucrChkIncludeQCStatus.Checked = False
+ Me.ucrChkIncludeQCStatus.Location = New System.Drawing.Point(6, 269)
Me.ucrChkIncludeQCStatus.Name = "ucrChkIncludeQCStatus"
Me.ucrChkIncludeQCStatus.Size = New System.Drawing.Size(295, 23)
Me.ucrChkIncludeQCStatus.TabIndex = 0
@@ -147,8 +155,8 @@ Partial Class sdgClimsoft
'ucrChkIncludeLevel
'
Me.ucrChkIncludeLevel.AutoSize = True
- Me.ucrChkIncludeLevel.Checked = True
- Me.ucrChkIncludeLevel.Location = New System.Drawing.Point(6, 90)
+ Me.ucrChkIncludeLevel.Checked = False
+ Me.ucrChkIncludeLevel.Location = New System.Drawing.Point(6, 196)
Me.ucrChkIncludeLevel.Name = "ucrChkIncludeLevel"
Me.ucrChkIncludeLevel.Size = New System.Drawing.Size(295, 23)
Me.ucrChkIncludeLevel.TabIndex = 19
@@ -174,8 +182,8 @@ Partial Class sdgClimsoft
'ucrChkIncludeAquistion
'
Me.ucrChkIncludeAquistion.AutoSize = True
- Me.ucrChkIncludeAquistion.Checked = True
- Me.ucrChkIncludeAquistion.Location = New System.Drawing.Point(6, 66)
+ Me.ucrChkIncludeAquistion.Checked = False
+ Me.ucrChkIncludeAquistion.Location = New System.Drawing.Point(6, 168)
Me.ucrChkIncludeAquistion.Name = "ucrChkIncludeAquistion"
Me.ucrChkIncludeAquistion.Size = New System.Drawing.Size(295, 23)
Me.ucrChkIncludeAquistion.TabIndex = 16
@@ -183,8 +191,8 @@ Partial Class sdgClimsoft
'ucrChkIncludeEntryForm
'
Me.ucrChkIncludeEntryForm.AutoSize = True
- Me.ucrChkIncludeEntryForm.Checked = True
- Me.ucrChkIncludeEntryForm.Location = New System.Drawing.Point(6, 114)
+ Me.ucrChkIncludeEntryForm.Checked = False
+ Me.ucrChkIncludeEntryForm.Location = New System.Drawing.Point(6, 220)
Me.ucrChkIncludeEntryForm.Name = "ucrChkIncludeEntryForm"
Me.ucrChkIncludeEntryForm.Size = New System.Drawing.Size(295, 23)
Me.ucrChkIncludeEntryForm.TabIndex = 15
@@ -192,35 +200,71 @@ Partial Class sdgClimsoft
'ucrChkIncludeFlag
'
Me.ucrChkIncludeFlag.AutoSize = True
- Me.ucrChkIncludeFlag.Checked = True
- Me.ucrChkIncludeFlag.Location = New System.Drawing.Point(7, 210)
+ Me.ucrChkIncludeFlag.Checked = False
+ Me.ucrChkIncludeFlag.Location = New System.Drawing.Point(7, 321)
Me.ucrChkIncludeFlag.Name = "ucrChkIncludeFlag"
Me.ucrChkIncludeFlag.Size = New System.Drawing.Size(295, 23)
Me.ucrChkIncludeFlag.TabIndex = 14
'
- 'ucrChkImportElementsMetadata
+ 'tbpMoreOptions
'
- Me.ucrChkImportElementsMetadata.AutoSize = True
- Me.ucrChkImportElementsMetadata.Checked = True
- Me.ucrChkImportElementsMetadata.Location = New System.Drawing.Point(0, 46)
- Me.ucrChkImportElementsMetadata.Name = "ucrChkImportElementsMetadata"
- Me.ucrChkImportElementsMetadata.Size = New System.Drawing.Size(315, 23)
- Me.ucrChkImportElementsMetadata.TabIndex = 20
+ Me.tbpMoreOptions.Controls.Add(Me.tbColumns)
+ Me.tbpMoreOptions.Controls.Add(Me.tbpTitles)
+ Me.tbpMoreOptions.Location = New System.Drawing.Point(-1, 4)
+ Me.tbpMoreOptions.Name = "tbpMoreOptions"
+ Me.tbpMoreOptions.SelectedIndex = 0
+ Me.tbpMoreOptions.Size = New System.Drawing.Size(417, 393)
+ Me.tbpMoreOptions.TabIndex = 2
'
- 'ucrChkImportStationsMetadata
+ 'ucrBaseSubdialog
'
- Me.ucrChkImportStationsMetadata.AutoSize = True
- Me.ucrChkImportStationsMetadata.Checked = True
- Me.ucrChkImportStationsMetadata.Location = New System.Drawing.Point(0, 22)
- Me.ucrChkImportStationsMetadata.Name = "ucrChkImportStationsMetadata"
- Me.ucrChkImportStationsMetadata.Size = New System.Drawing.Size(315, 23)
- Me.ucrChkImportStationsMetadata.TabIndex = 19
+ Me.ucrBaseSubdialog.AutoSize = True
+ Me.ucrBaseSubdialog.Location = New System.Drawing.Point(88, 397)
+ Me.ucrBaseSubdialog.Name = "ucrBaseSubdialog"
+ Me.ucrBaseSubdialog.Size = New System.Drawing.Size(224, 29)
+ Me.ucrBaseSubdialog.TabIndex = 3
+ '
+ 'ucrChkIncludeElementId
+ '
+ Me.ucrChkIncludeElementId.AutoSize = True
+ Me.ucrChkIncludeElementId.Checked = False
+ Me.ucrChkIncludeElementId.Location = New System.Drawing.Point(7, 116)
+ Me.ucrChkIncludeElementId.Name = "ucrChkIncludeElementId"
+ Me.ucrChkIncludeElementId.Size = New System.Drawing.Size(295, 23)
+ Me.ucrChkIncludeElementId.TabIndex = 23
+ '
+ 'ucrChkIncludeStationId
+ '
+ Me.ucrChkIncludeStationId.AutoSize = True
+ Me.ucrChkIncludeStationId.Checked = False
+ Me.ucrChkIncludeStationId.Location = New System.Drawing.Point(7, 92)
+ Me.ucrChkIncludeStationId.Name = "ucrChkIncludeStationId"
+ Me.ucrChkIncludeStationId.Size = New System.Drawing.Size(295, 23)
+ Me.ucrChkIncludeStationId.TabIndex = 22
+ '
+ 'ucrChkIncludeDateTime
+ '
+ Me.ucrChkIncludeDateTime.AutoSize = True
+ Me.ucrChkIncludeDateTime.Checked = True
+ Me.ucrChkIncludeDateTime.Location = New System.Drawing.Point(7, 66)
+ Me.ucrChkIncludeDateTime.Name = "ucrChkIncludeDateTime"
+ Me.ucrChkIncludeDateTime.Size = New System.Drawing.Size(295, 23)
+ Me.ucrChkIncludeDateTime.TabIndex = 24
+ '
+ 'ucrChkIncludeElementName
+ '
+ Me.ucrChkIncludeElementName.AutoSize = True
+ Me.ucrChkIncludeElementName.Checked = False
+ Me.ucrChkIncludeElementName.Location = New System.Drawing.Point(7, 141)
+ Me.ucrChkIncludeElementName.Name = "ucrChkIncludeElementName"
+ Me.ucrChkIncludeElementName.Size = New System.Drawing.Size(295, 23)
+ Me.ucrChkIncludeElementName.TabIndex = 25
'
'sdgClimsoft
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
- Me.ClientSize = New System.Drawing.Size(417, 348)
+ Me.ClientSize = New System.Drawing.Size(417, 434)
Me.Controls.Add(Me.ucrBaseSubdialog)
Me.Controls.Add(Me.tbpMoreOptions)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow
@@ -256,4 +300,8 @@ Partial Class sdgClimsoft
Friend WithEvents ucrChkIncludeCapturedBy As ucrCheck
Friend WithEvents ucrChkIncludeLevel As ucrCheck
Friend WithEvents ucrChkIncludeQCLog As ucrCheck
+ Friend WithEvents ucrChkIncludeElementId As ucrCheck
+ Friend WithEvents ucrChkIncludeStationId As ucrCheck
+ Friend WithEvents ucrChkIncludeDateTime As ucrCheck
+ Friend WithEvents ucrChkIncludeElementName As ucrCheck
End Class
\ No newline at end of file
diff --git a/instat/sdgClimsoft.resx b/instat/sdgClimsoft.resx
new file mode 100644
index 00000000000..1af7de150c9
--- /dev/null
+++ b/instat/sdgClimsoft.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/instat/sdgClimsoft.vb b/instat/sdgClimsoft.vb
index d6a61a9bb2a..c1a48427aa3 100644
--- a/instat/sdgClimsoft.vb
+++ b/instat/sdgClimsoft.vb
@@ -31,52 +31,65 @@ Public Class sdgClimsoft
'Columns to include
'---------------------------------------
ucrChkIncludeStationName.SetText("Station Name")
- ucrChkIncludeStationName.SetParameter(New RParameter("include_station_name", 13))
- ucrChkIncludeStationName.SetRDefault("TRUE")
+ ucrChkIncludeStationName.Enabled = False
ucrChkIncludeElementAbbrv.SetText("Element Abbreviation")
- ucrChkIncludeElementAbbrv.SetParameter(New RParameter("include_element_abbreviation", 14))
- ucrChkIncludeElementAbbrv.SetRDefault("TRUE")
+ ucrChkIncludeElementAbbrv.Enabled = False
+
+ ucrChkIncludeDateTime.SetText("Date Time")
+ ucrChkIncludeDateTime.Enabled = False
+
+ ucrChkIncludeStationId.SetText("Station Id")
+ ucrChkIncludeStationId.SetParameter(New RParameter("include_station_id", 13))
+ ucrChkIncludeStationId.SetRDefault("FALSE")
+
+ ucrChkIncludeElementId.SetText("Element Id")
+ ucrChkIncludeElementId.SetParameter(New RParameter("include_element_id", 14))
+ ucrChkIncludeElementId.SetRDefault("FALSE")
+
+ ucrChkIncludeElementName.SetText("Element Name")
+ ucrChkIncludeElementName.SetParameter(New RParameter("include_element_name", 15))
+ ucrChkIncludeElementName.SetRDefault("FALSE")
ucrChkIncludeAquistion.SetText("Acquisition Type")
- ucrChkIncludeAquistion.SetParameter(New RParameter("include_acquisition_type", 15))
- ucrChkIncludeAquistion.SetRDefault("TRUE")
+ ucrChkIncludeAquistion.SetParameter(New RParameter("include_acquisition_type", 16))
+ ucrChkIncludeAquistion.SetRDefault("FALSE")
ucrChkIncludeLevel.SetText("Level")
- ucrChkIncludeLevel.SetParameter(New RParameter("include_level", 16))
- ucrChkIncludeLevel.SetRDefault("TRUE")
+ ucrChkIncludeLevel.SetParameter(New RParameter("include_level", 17))
+ ucrChkIncludeLevel.SetRDefault("FALSE")
ucrChkIncludeEntryForm.SetText("Entry Form")
- ucrChkIncludeEntryForm.SetParameter(New RParameter("include_entry_form", 17))
- ucrChkIncludeEntryForm.SetRDefault("TRUE")
+ ucrChkIncludeEntryForm.SetParameter(New RParameter("include_entry_form", 18))
+ ucrChkIncludeEntryForm.SetRDefault("FALSE")
ucrChkIncludeCapturedBy.SetText("Captured By (user)")
- ucrChkIncludeCapturedBy.SetParameter(New RParameter("include_captured_by", 18))
- ucrChkIncludeCapturedBy.SetRDefault("TRUE")
+ ucrChkIncludeCapturedBy.SetParameter(New RParameter("include_captured_by", 19))
+ ucrChkIncludeCapturedBy.SetRDefault("FALSE")
ucrChkIncludeQCStatus.SetText("QC Status")
- ucrChkIncludeQCStatus.SetParameter(New RParameter("include_qc_status", 19))
- ucrChkIncludeQCStatus.SetRDefault("TRUE")
+ ucrChkIncludeQCStatus.SetParameter(New RParameter("include_qc_status", 20))
+ ucrChkIncludeQCStatus.SetRDefault("FALSE")
ucrChkIncludeQCLog.SetText("QC Log")
- ucrChkIncludeQCLog.SetParameter(New RParameter("include_qc_log", 20))
- ucrChkIncludeQCLog.SetRDefault("TRUE")
+ ucrChkIncludeQCLog.SetParameter(New RParameter("include_qc_log", 21))
+ ucrChkIncludeQCLog.SetRDefault("FALSE")
ucrChkIncludeFlag.SetText("Flag")
- ucrChkIncludeFlag.SetParameter(New RParameter("include_flag", 21))
- ucrChkIncludeFlag.SetRDefault("TRUE")
+ ucrChkIncludeFlag.SetParameter(New RParameter("include_flag", 22))
+ ucrChkIncludeFlag.SetRDefault("FALSE")
'---------------------------------------
'Metadata
'---------------------------------------
ucrChkImportStationsMetadata.SetText("Selected Stations")
- ucrChkImportStationsMetadata.SetParameter(New RParameter("import_selected_stations_metadata", 12))
- ucrChkImportStationsMetadata.SetRDefault("TRUE")
+ ucrChkImportStationsMetadata.SetParameter(New RParameter("import_selected_stations_metadata", 23))
+ ucrChkImportStationsMetadata.SetRDefault("FALSE")
ucrChkImportElementsMetadata.SetText("Selected Elements")
- ucrChkImportElementsMetadata.SetParameter(New RParameter("import_selected_elements_metadata", 13))
- ucrChkImportElementsMetadata.SetRDefault("TRUE")
+ ucrChkImportElementsMetadata.SetParameter(New RParameter("import_selected_elements_metadata", 24))
+ ucrChkImportElementsMetadata.SetRDefault("FALSE")
'---------------------------------------
bControlsInitialised = True
@@ -89,8 +102,9 @@ Public Class sdgClimsoft
'Columns
'---------------------------------------
- ucrChkIncludeStationName.SetRCode(clsRFunction, bReset)
- ucrChkIncludeElementAbbrv.SetRCode(clsRFunction, bReset)
+ ucrChkIncludeStationId.SetRCode(clsRFunction, bReset)
+ ucrChkIncludeElementId.SetRCode(clsRFunction, bReset)
+ ucrChkIncludeElementName.SetRCode(clsRFunction, bReset)
ucrChkIncludeAquistion.SetRCode(clsRFunction, bReset)
ucrChkIncludeLevel.SetRCode(clsRFunction, bReset)
ucrChkIncludeEntryForm.SetRCode(clsRFunction, bReset)
diff --git a/instat/static/InstatObject/R/instat_object_R6.R b/instat/static/InstatObject/R/instat_object_R6.R
index 95c44c5c065..78fe1743d8b 100644
--- a/instat/static/InstatObject/R/instat_object_R6.R
+++ b/instat/static/InstatObject/R/instat_object_R6.R
@@ -1867,7 +1867,7 @@ DataBook$set("public", "get_db_table_row_count", function(tableName, query_condi
#Imports Climsoft metadata.
DataBook$set("public", "import_climsoft_metadata", function(import_stations = FALSE, import_elements = FALSE, import_flags = FALSE) {
- if(!import_stations || !import_elements){
+ if(!import_stations && !import_elements){
stop("No metadata selected for import")
}
@@ -1918,17 +1918,16 @@ DataBook$set("public", "import_climsoft_metadata", function(import_stations = FA
})
-
-#imports data from climsoft observation tables; initial or final.
+#imports data from Climsoft observation tables; initial or final.
#imports selected stations and elements metadata
DataBook$set("public", "import_climsoft_data", function(tableName,
station_filter_column, stations = c(),
element_filter_column, elements = c(),
- qc_status = -1, start_date = NULL, end_date = NULL,
- include_station_name = TRUE, include_element_abbreviation = TRUE, include_qc_status = TRUE,
- include_acquisition_type = TRUE, include_flag = TRUE, include_entry_form = TRUE,
- include_qc_log = TRUE, include_captured_by = TRUE, include_level = TRUE,
- import_selected_stations_metadata = TRUE, import_selected_elements_metadata = TRUE) {
+ qc_status = -1, start_date = NULL, end_date = NULL, unstack_data = FALSE,
+ include_station_id = FALSE, include_element_id = FALSE, include_element_name = FALSE,
+ include_acquisition_type = FALSE, include_level = FALSE, include_entry_form = FALSE, include_captured_by = FALSE,
+ include_qc_status = FALSE, include_qc_log = FALSE, include_flag = FALSE,
+ import_selected_stations_metadata = FALSE, import_selected_elements_metadata = FALSE) {
#connection and parameter checks
#--------------------------------
con <- self$get_database_connection()
@@ -1951,16 +1950,24 @@ DataBook$set("public", "import_climsoft_data", function(tableName,
#selects
#--------------------------------
- sql_select <- paste0(tableName,".recordedFrom AS station_id")
+
+ sql_select<- ""
- if(include_station_name){
+ if(include_station_id){
+ sql_select <- paste0(tableName,".recordedFrom AS station_id")
sql_select <-paste0(sql_select,", station.stationName AS station_name")
+ }else{
+ sql_select <-"station.stationName AS station_name"
+ }
+
+ if(include_element_id){
+ sql_select <-paste0(sql_select, ", ", tableName,".describedBy AS element_id")
}
- sql_select <-paste0(sql_select, ", ", tableName,".describedBy AS element_id")
+ sql_select <-paste0(sql_select,", obselement.abbreviation AS element_abbrv")
- if(include_element_abbreviation){
- sql_select <-paste0(sql_select,", obselement.abbreviation AS element_abbrv")
+ if(include_element_name){
+ sql_select <-paste0(sql_select,", obselement.elementName AS element_name")
}
if(include_acquisition_type){
@@ -2045,20 +2052,29 @@ DataBook$set("public", "import_climsoft_data", function(tableName,
observations_data_name <- next_default_item("observations_data", self$get_data_names(), include_index = FALSE)
data_list[[observations_data_name]] <- DBI::dbGetQuery(con,paste0(sql_select, sql_filter, sql_order_by))
+ if(unstack_data){
+ observations_unstacked_data_name <- next_default_item("observations_unstacked_data", self$get_data_names(), include_index = FALSE)
+ data_list[[observations_unstacked_data_name]] <- reshape2::dcast(data = data_list[[observations_data_name]], formula = station_name + date_time ~ element_abbrv, value.var = "value")
+ }
+
self$import_data(data_tables = data_list)
#--------------------------------
#transform imported data
#--------------------------------
- self$convert_column_to_type(data_name = observations_data_name, col_names = c("station_id","element_id"), to_type = "factor")
+ self$convert_column_to_type(data_name = observations_data_name, col_names = c("station_name","element_abbrv"), to_type = "factor")
+
+ if(include_station_id){
+ self$convert_column_to_type(data_name = observations_data_name, col_names = "station_id", to_type = "factor")
+ }
- if(include_station_name){
- self$convert_column_to_type(data_name = observations_data_name, col_names = "station_name", to_type = "factor")
+ if(include_element_id){
+ self$convert_column_to_type(data_name = observations_data_name, col_names = "element_id", to_type = "factor")
}
- if(include_element_abbreviation){
- self$convert_column_to_type(data_name = observations_data_name, col_names = "element_abbrv", to_type = "factor")
+ if(include_element_name){
+ self$convert_column_to_type(data_name = observations_data_name, col_names = "element_name", to_type = "factor")
}
if(include_qc_status){
@@ -2083,13 +2099,13 @@ DataBook$set("public", "import_climsoft_data", function(tableName,
#todo. should this be done at this point?? Keeping in mind that we may have hourly data
#create a plain date column from the observation data datetime column values
- obsdate <- self$get_columns_from_data(data_name = observations_data_name, col_names = "date_time", use_current_filter = FALSE)
- self$add_columns_to_data(data_name = observations_data_name, col_name = "date", col_data = as.Date(x = obsdate), before = FALSE, adjacent_column = "date_time")
+ #obsdate <- self$get_columns_from_data(data_name = observations_data_name, col_names = "date_time", use_current_filter = FALSE)
+ #self$add_columns_to_data(data_name = observations_data_name, col_name = "date", col_data = as.Date(x = obsdate), before = FALSE, adjacent_column = "date_time")
#--------------------------------
})
-#TODO. Deprecated. Delete this after after deleting the import from climsoft wizard dialog
+#TODO. Deprecated. Delete this after after deleting the import from Climsoft wizard dialog
DataBook$set("public", "import_from_climsoft", function(stationfiltercolumn = "stationId", stations = c(), elementfiltercolumn = "elementId", elements = c(), include_observation_data = FALSE, include_observation_flags = FALSE, unstack_data = FALSE, include_elements_info = FALSE, start_date = NULL, end_date = NULL) {
#need to perform checks here
con <- self$get_database_connection()