if (interactive()) {
library(surveydown)
# Use sd_store_value() to store custom values in the database:
# server <- function(input, output, session) {
# # Store a generated value
# respondentID <- sample(1:1000, 1)
# sd_store_value(respondentID, "respID", db)
#
# # Store with automatic ID detection
# completion_code <- sample(0:9, 6, replace = TRUE)
# sd_store_value(completion_code, db = db)
#
# # Store without auto-assignment
# stored_val <- sd_store_value(42, "my_value", db, auto_assign = FALSE)
#
# sd_server()
# }
# Find a working directory and start from a template:
sd_create_survey(template = "reactive_questions")
# This creates survey.qmd and app.R - launch the survey using app.R
}
Run the code above in your browser using DataLab