Skip to content

Commit

Permalink
Merge branch 'IDEMSInternational:master' into Frontmnu
Browse files Browse the repository at this point in the history
  • Loading branch information
Fidel365 authored Jul 27, 2024
2 parents 4a10487 + 470eaea commit 54d5c58
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 22 deletions.
33 changes: 23 additions & 10 deletions instat/dlgFindInVariableOrFilter.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 16 additions & 2 deletions instat/dlgFindInVariableOrFilter.vb
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,16 @@ Public Class dlgFindInVariableOrFilter
ucrChkIncludeRegularExpressions.SetParameter(New RParameter("use_regex", 4))
ucrChkIncludeRegularExpressions.SetValuesCheckedAndUnchecked("TRUE", "FALSE")

ucrPnlOptions.AddToLinkedControls({ucrInputPattern, ucrPnlSelect, ucrChkIgnoreCase, ucrChkIncludeRegularExpressions}, {rdoVariable}, bNewLinkedHideIfParameterMissing:=True)
ucrWholeValue.SetText("Whole Value")
ucrWholeValue.SetParameter(New RParameter("match_entire_cell", 5))
ucrWholeValue.SetValuesCheckedAndUnchecked("TRUE", "FALSE")

ucrPnlOptions.AddToLinkedControls({ucrInputPattern, ucrPnlSelect, ucrChkIgnoreCase, ucrChkIncludeRegularExpressions, ucrWholeValue}, {rdoVariable}, bNewLinkedHideIfParameterMissing:=True)
ucrInputPattern.SetLinkedDisplayControl(lblPattern)
ucrPnlSelect.SetLinkedDisplayControl(grpSelect)

ucrBase.OKEnabled(False)
ucrBase.cmdReset.Enabled = False
ucrBase.cmdReset.Enabled = True
End Sub

Private Sub SetDefaults()
Expand Down Expand Up @@ -113,6 +117,7 @@ Public Class dlgFindInVariableOrFilter
clsGetRowHeadersFunction.AddParameter("data", clsRFunctionParameter:=clsGetDataFrameFunction, iPosition:=0)
clsGetRowHeadersFunction.AddParameter("ignore_case", "TRUE", iPosition:=3)
clsGetRowHeadersFunction.AddParameter("use_regex", "FALSE", iPosition:=4)
clsGetRowHeadersFunction.AddParameter("match_entire_cell", "FALSE", iPosition:=5)

ucrReceiverVariable.SetMeAsReceiver()
cmdFindNext.Enabled = False
Expand All @@ -126,6 +131,7 @@ Public Class dlgFindInVariableOrFilter
ucrSelectorFind.SetRCode(clsGetDataFrameFunction, bReset)
ucrReceiverVariable.SetRCode(clsGetRowHeadersFunction, bReset)
ucrChkIgnoreCase.SetRCode(clsGetRowHeadersFunction, bReset)
ucrWholeValue.SetRCode(clsGetRowHeadersFunction, bReset)
ucrChkIncludeRegularExpressions.SetRCode(clsGetRowHeadersFunction, bReset)
ucrPnlOptions.SetRCode(clsDummyFunction, bReset)
ucrPnlSelect.SetRCode(clsDummyFunction, bReset)
Expand Down Expand Up @@ -155,6 +161,14 @@ Public Class dlgFindInVariableOrFilter
End If
End Function

Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset
ucrSelectorFind.Reset()
rdoVariable.Checked = True
rdoCell.Checked = True
ucrReceiverVariable.Clear()
ucrInputPattern.cboInput.ResetText()
End Sub

Private Sub cmdFind_Click(sender As Object, e As EventArgs) Handles cmdFind.Click
Try
If rdoVariable.Checked OrElse rdoInFilter.Checked Then
Expand Down
12 changes: 8 additions & 4 deletions instat/dlgInventoryPlot.vb
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ Public Class dlgInventoryPlot
SetDefaults()
SetRCodeForControls(True)
TestOkEnabled()

End Sub

Private Sub ucrPnlOptions_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlOptions.ControlValueChanged
Expand All @@ -335,6 +334,7 @@ Public Class dlgInventoryPlot
clsInventoryPlot.iCallType = 3
clsInventoryPlot.bExcludeAssignedFunctionOutput = False
End If
AddClimateMissingFunction()
End Sub

Private Sub AddOrRemoveKeyFunctions()
Expand All @@ -347,13 +347,17 @@ Public Class dlgInventoryPlot
End If
End Sub

Private Sub ucrChkSummary_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkSummary.ControlValueChanged
If ucrChkSummary.Checked Then
Private Sub AddClimateMissingFunction()
If rdoMissing.Checked AndAlso ucrChkSummary.Checked Then
ucrBase.clsRsyntax.AddToAfterCodes(clsClimaticMissing, iPosition:=1)
clsClimaticMissing.iCallType = 2
Else
ucrBase.clsRsyntax.RemoveFromAfterCodes(clsClimaticMissing)
End If
End If
End Sub

Private Sub ucrChkSummary_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkSummary.ControlValueChanged, ucrChkOmitEnd.ControlValueChanged, ucrChkOmitStart.ControlValueChanged
AddClimateMissingFunction()
AddOrRemoveKeyFunctions()
End Sub

Expand Down
4 changes: 3 additions & 1 deletion instat/frmMain.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 14 additions & 5 deletions instat/static/InstatObject/R/stand_alone_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -2977,14 +2977,23 @@ cumulative_inventory <- function(data, station = NULL, from, to){
return(data)
}

getRowHeadersWithText <- function(data, column, searchText, ignore_case, use_regex) {
if(use_regex){
getRowHeadersWithText <- function(data, column, searchText, ignore_case, use_regex, match_entire_cell) {
if (use_regex) {
# Adjust the search text to match the entire cell if required
if (match_entire_cell) {
searchText <- paste0("^", searchText, "$")
}
# Find the rows that match the search text using regex
matchingRows <- stringr::str_detect(data[[column]], stringr::regex(searchText, ignore_case = ignore_case))
}else if (is.na(searchText)){
} else if (is.na(searchText)) {
matchingRows <- apply(data[, column, drop = FALSE], 1, function(row) any(is.na(row)))
}else{
matchingRows <- grepl(searchText, data[[column]], ignore.case = ignore_case)
} else {
# Adjust the search text to match the entire cell if required
if (match_entire_cell) {
searchText <- paste0("^", searchText, "$")
}
# Find the rows that match the search text
matchingRows <- grepl(searchText, data[[column]], ignore.case = ignore_case, perl = TRUE)
}
# Get the row headers where the search text is found
rowHeaders <- rownames(data)[matchingRows]
Expand Down

0 comments on commit 54d5c58

Please sign in to comment.