Commit e5e22791 authored by Yong Liu's avatar Yong Liu

Refs #6186

parent 659240c6
......@@ -4687,6 +4687,7 @@ compareDataExport <- function(comparedScript, len, ...){
glabel(paste(ncol(getd("variablemanagerCurrentObject")), "variables", nrow(getd("variablemanagerCurrentObject")), "records", sep=" "), container=topGroup)
df <- gtable(getd("variablemanagerdata"), container=LeftscriptWidget, expand=TRUE)
putd("toKeep", df[])
putd("toKeepOrig", df[])
addhandlerclicked(df, handler<-function(h,...) {
obj = svalue(h$obj, index=TRUE)
if(!is.null(obj) && length(obj) > 0) {
......@@ -4818,29 +4819,32 @@ compareDataExport <- function(comparedScript, len, ...){
gbutton("Apply", container=saveCancelGroup, handler=function(h,...) {
#
toKeep = getd("toKeep")
keys <- toKeep$"Name"[toKeep$"Selected.As" %in% "Categorical Key"]
conts <- toKeep$"Name"[toKeep$"Selected.As" %in% "Continuous Key"]
weights <- toKeep$"Name"[toKeep$"Selected.As" %in% "Weight"]
stratas <- toKeep$"Name"[toKeep$"Selected.As" %in% "Strata"]
clusterIds <- toKeep$"Name"[toKeep$"Selected.As" %in% "Cluster-Id"]
toKeepOrig = getd("toKeepOrig")
if(!identical(toKeep, toKeepOrig)) {
val <- gconfirm("This will reset your script and all anonymisation work. Do you want to continue?", parent=variableManagerWindow)
if(as.logical(val) ) {
keys <- toKeep$"Name"[toKeep$"Selected.As" %in% "Categorical Key"]
conts <- toKeep$"Name"[toKeep$"Selected.As" %in% "Continuous Key"]
weights <- toKeep$"Name"[toKeep$"Selected.As" %in% "Weight"]
stratas <- toKeep$"Name"[toKeep$"Selected.As" %in% "Strata"]
clusterIds <- toKeep$"Name"[toKeep$"Selected.As" %in% "Cluster-Id"]
if(existd("sdcObject") && !is.null(ActiveSdcObject()@deletedVars)){
names <- ActiveSdcObject()@deletedVars
} else {
names <- character(0)
}
confirmSelection_tmp(keys, conts, weights, clusterIds, stratas)
left <- toKeep$Deleted %in% "No"
if(length(names)>0 || length(toKeep$Name[!left])>0) {
names <- c(toKeep$Name[!left], names)
df[] <- toKeep[left,]
svalue(df, index=TRUE) <- 1
removeDirectID_tmp(names)
if(existd("sdcObject") && !is.null(ActiveSdcObject()@deletedVars)){
names <- ActiveSdcObject()@deletedVars
} else {
names <- character(0)
}
confirmSelection_tmp(keys, conts, weights, clusterIds, stratas)
left <- toKeep$Deleted %in% "No"
if(length(names)>0 || length(toKeep$Name[!left])>0) {
names <- c(toKeep$Name[!left], names)
df[] <- toKeep[left,]
svalue(df, index=TRUE) <- 1
removeDirectID_tmp(names)
}
updateRightFrame()
}
}
createVariableManagerData()
df[] <- getd("variablemanagerdata")
putd("toKeep", df[])
updateRightFrame()
quitVariableManagerWindow()
} )
gbutton("Generate Strata Variable", container=saveCancelGroup, handler=function(h,...) {
......@@ -4943,6 +4947,7 @@ compareDataExport <- function(comparedScript, len, ...){
createVariableManagerData()
df[] <- getd("variablemanagerdata")
putd("toKeep", df[])
putd("toKeepOrig", df[])
updateRightFrame()
dispose(stVar_window)
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment