I am a beginner to R programming. I am converting the previously hard corded lists to dynamic list for multiple fields from postgresql.
Here is my requirement:
-connect to db
- get the values from the table
(Table: list_of_val
columns: param_name, param_value
Filter by param_name, I plan to change the WHERE param_name = 'xxxxx' for each field)
-populate the values for the drop down list, for all the fields.
I am not clear on my approach and not sure where I am making the mistake. Part of my code is below.
con <-
dbConnect(
drv,
dbname = db,
host = host_db,
port = db_port,
user = db_user,
password = db_password
)
Querying Database to get the values
SBU_list <- "SELECT v.param_value
FROM
load_from_s3.list_of_val v
WHERE
param_name = 'SBU'
ORDER BY param_value ASC"
data = dbGetQuery(con, SBU_list)
observe({
updateSelectInput(session, "filter_sbu", choices = SBU_list)
}),
Thanks in advance