Skip to content
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

Merged
merged 9 commits into from
Apr 25, 2016
Merged

Conversation

deaspo
Copy link
Contributor

@deaspo deaspo commented Apr 5, 2016

No description provided.

@dannyparsons
Copy link
Contributor

This looks good so far. Do you want it to be accepted or will you carry on with the TODO parts?

@deaspo
Copy link
Contributor Author

deaspo commented Apr 11, 2016

This is ready, have done the ToDo parts.

@dannyparsons
Copy link
Contributor

Ok I'll clone and check it out.

@deaspo
Copy link
Contributor Author

deaspo commented Apr 20, 2016

@dannyparsons I wonder what's remaining for this dialog? Am looking forward to finishing the File menu.

@dannyparsons
Copy link
Contributor

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?

@deaspo
Copy link
Contributor Author

deaspo commented Apr 23, 2016

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)
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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 Recode1column I added because surveyisn'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.

@dannyparsons
Copy link
Contributor

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.
I'll discuss with Roger on Monday about the options and layout we might want for this dialog, which you could implement or pass on to the Maseno team once you've got the functionality working, if you wanted.

@deaspo
Copy link
Contributor Author

deaspo commented Apr 25, 2016

Changed to using clsCurrDataFrame

@dannyparsons dannyparsons merged commit 8c27da6 into IDEMSInternational:master Apr 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants