-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export Datasets* dialog #1161
Export Datasets* dialog #1161
Conversation
Pulling changes from the main
Pulling changes from the main
This looks good so far. Do you want it to be accepted or will you carry on with the TODO parts? |
Pulling changes from the main
This is ready, have done the ToDo parts. |
Ok I'll clone and check it out. |
@dannyparsons I wonder what's remaining for this dialog? Am looking forward to finishing the File menu. |
sorry I forgot to get back to you on this. It would be great to be able to export multiple dataframes to one Excel file as an option. I think this would need to be through an Instat object method since we would need to loop through the dataframes to add them as a sheet one by one. The method could have options like, which dataframes to export, include metadata boolean, include variables metadara boolean (so that these can also be sheets). Do you think you could make a start on this? |
Yes, I can make a start on that but on a separate pull request. I do not see any reason to keep this one waiting, when I can add the option to the exporting when it's ready. |
chkOptions.Enabled = False | ||
grpOptions.Enabled = False | ||
clsWriteCSV.AddParameter("file", Chr(34) & strFilePath & Chr(34)) | ||
clsWriteCSV.AddParameter("x", ucrAvailableSheets.cboAvailableDataFrames.SelectedItem) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you should use the clsCurrDataFrame from the data frame selector as the parameter so that it gets the current version of the data. It's working now because the variables exists from the import, but it won't export any changes that have been made since import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clsCurrDataFrame is an RFunction, should I not be using strCurrDataFrame?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No because just putting the string means you use a variable with that name (if it exists in R). If you look at some example code:
setwd('C:/Users/Danny/Documents/GitHubVisualStudio/Instat/instat/bin/Debug/static/InstatObject/R')
source("Rsetup.R")
InstatDataObject <- instat_obj$new()
# dlgImportDatasetcode generated by the dialogImport Dataset
survey <- read.csv(header=TRUE,sep=",",dec=".",comment.char="",na.strings=NA,file="C:/Users/Danny/Google Drive/African Maths Initiative/0. Initiatives/4. Climate Data Work/Data/survey.csv")
InstatDataObject$import_data(data_tables = list(survey=survey))
# dlgRecodecode generated by the dialogRecode
Field <- InstatDataObject$get_columns_from_data(data_name="survey",col_name="Field")
Recode1 <- cut(include.lowest=TRUE,x=Field,breaks=c(0,10,20))
InstatDataObject$add_columns_to_data(data_name = "survey", col_name = "Recode1", col_data = Recode1)
# dlgExportDatasetcode generated by the dialogExport Datasets
write.csv(file="C:/Users/Danny/Google Drive/African Maths Initiative/0. Initiatives/4. Climate Data Work/Data/test_export.csv",x=survey)
The x = survey
in write.csv
means the variables survey
, which does exist, but it is the variable from the read.csv
. So the export won't have the Recode1
column I added because survey
isn't up to date.
Now see what happens if you pass in the RFunction as the parameter instead. You should see that it sorts this out in a clever way.
Ok that's fine if you would rather do that on a separate pull request. I just noticed one bug to fix and then I can accept. |
Pulling changes from the main
Changed to using clsCurrDataFrame |
No description provided.