Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
Maybe you can try to check out environmentVariableDao and its sample code at Manage Environment Variable using Form to figure out how to update environment variable value.
I want to execute a delete sql as well as an increment an environment variable, I am to fetch the variable it but dont know the syntax on how to update it ?
public Object execute(AppDefinition appDef, HttpServletRequest request) {
Connection con = null;
try {
DataSource ds = (DataSource)AppUtil.getApplicationContext().getBean("setupDataSource");
con = ds.getConnection();
FormDataDao formDataDao = (FormDataDao) AppUtil.getApplicationContext().getBean("formDataDao");
String envVar1= "#envVariable.cl_id#";
String testSql = "delete from app_fd_r_info where id LIKE '%,%' ";
stmtTest = con.prepareStatement(testSql);
stmtTest.executeUpdate();
}catch(Exception e) {
LogUtil.error("Sample app - Form 1", e, "Error loading user data in load binder");
} finally {
//always close the connection after used
try { if(con != null) {con.close();} } catch(SQLException e) {/* ignored */}
}
return null;
}
//call execute method with injected variable