I want to develop a UDSF in R with multiple arguments. Something like below
validate <- function(x,tname,cname)
{
var <- x
tableName <- tname
colName <- cname
result <- sqlQuery(myconn, paste(" SELECT COUNT(*) FROM", tableName, "WHERE", colName,"=",val))
if (result > 0 )
{
return(x)
}
else
{
return(1000)
}
}
validateFactory <- function()
{
list(name=validate, udxtype=c("scalar"), intype=c("int","varchar","varchar"), outtype=c("int"))
}
But I am no unable to use the actual values for arguments "tname" and "cname" in this.
This works if there is a single arguments but not for more than 1.
How can I use data.frame or something else to fix this?
Sign up
Already have an account? Login
Welcome to the Rocket Forum!
Please log in or register:
Employee Login | Registration Member Login | RegistrationEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.