Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
Hi,
tried the article using 7.0.30 and had no issue tho.
says in your error log there's "class: Datasource not found in namespace" in one of your beanshell form binder. Did you import the class into the beanshell? import
javax.sql.DataSource;
Hi, can u share the link article using 7.0.30?
What I meant was that I used Joget version 7.0.30 (the latest version) to try the article you mentioned. I copy-pasted the code from the article and it works fine.
Saw the error log, can you check whether you have import
javax.sql.DataSource;
in your bean shell? If not, add it and see if it works?
Try removing 1 bean shell just to identify where is the error located, either in load or store
How to check whether have import
javax.sql.DataSource;
in your bean shell? u means plugin?
I already try to load the data also get the error.
Error :-
29-Jun-2022 09:25:30.131 SEVERE [http-nio-8080-exec-934] org.apache.coyote.AbstractProtocol$ConnectionHandler.process Error reading request, ignored
java.lang.IllegalStateException: Calling [asyncPostProcess()] is not valid for a request with Async state [ERROR]
at org.apache.coyote.AsyncStateMachine.asyncPostProcess(AsyncStateMachine.java:289)
at org.apache.coyote.AbstractProcessor.asyncPostProcess(AbstractProcessor.java:197)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:81)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:818)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1626)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:829)
hmm....this looks like a different error from the pic u gave...
can you create a sample app with relevant data, export the app and paste it here? oh, and provide steps on how to reproduce the error?
Hi, Attached is sample Apps.APP_SecretaryForm-2-20220630034722.jwa.
1) Key in TypeRequisition form.
2) Click Company Secretary Form. grid will display data from table Type Requisition.(Its my problem now, error when load & Store form binder).
3) Key in the record and click submit button.
* When click submit button, record in grid listing not update also.
FYI, im using Joget community.
APP_SecretaryForm-2.jwa
Check out the form grid's load binder bean shell. I put some notes in there. Hope this helps.
FYI, if you're planning to use it for your company. Use the enterprise to try the enterprise features. Most if not all of the enterprise feature is pretty good. In the Enterprise version, the 1st 3 users is free indefinitely (username: admin, cat & clark)
Hi Ian, Thanks a lot for load binder bean shell successful. But for store binder bean shell still problem. I want to display all data from table Type Requisition to grid listing in form Secretary Requisition Form. When i update the record in grid listing, displayed error message.
Yeah for storing the grid listing it's basically a 1-to-many relationship i.e 1 Company Secretary Requisition Form has many type requisitions. You'll need a foreign key and possibly another table so whatever you update the grid, it won't affect typerequisition table.
One-to-Many Relationships in a Database (lifewire.com)
Again, my suggestion is use Joget's Enterprise Edition. There's a plugin that makes things a whole lot easier where you don't have to write a beanshell for it. All you need is a hidden field as a foreign key and point to the form.
Hi,
I want to insert Quantity in grid listing, but when i insert the record and Click Submit button , the error message displayed as below. For load grid im using JDBC, and for store the data using Bean Shell form binder.
I'm already refer this link below. Anyone can help me?
Load and Store Form Grid Data Using Bean Shell Form Binder
Code for Load Using JDBC
SELECT id, c_TypeRequisition FROM app_fd_TypeRequisition
→ to get value TypeRequisition from table TypeRequisition
Code for Store Data
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.sql.DataSource;
import org.joget.apps.app.service.AppUtil;
import org.joget.apps.form.model.Form;
import org.joget.apps.form.model.Element;
import org.joget.apps.form.model.FormData;
import org.joget.apps.form.model.FormRow;
import org.joget.apps.form.model.FormRowSet;
import org.joget.apps.form.service.FormUtil;
import org.joget.commons.util.UuidGenerator;
public saveGridRows(Element element, FormRowSet rows, FormData formData) {
String recordId = null;
Connection con = null;
try {
//Get Joget's current datasource configs
DataSource ds = (DataSource) AppUtil.getApplicationContext().getBean("setupDataSource");
con = ds.getConnection();
if(!con.isClosed()) {
//To generate new record IDs for storing into child table
// UuidGenerator uuid = UuidGenerator.getInstance();
//Iterate to add new records
Iterator i= rows.iterator();
while (i.hasNext()) {
FormRow row = (FormRow) i.next();
// String pId = uuid.getUuid();
String TypeRequisition = row.get("TypeRequisition");
String Quantity= row.get("Quantity");
String CTC = row.get("CTC");
String insertSql = "INSERT INTO app_fd_CompanySecretary (TypeRequisition,Quantity,CTC) VALUES (?,?,?);";
PreparedStatement stmtInsert = con.prepareStatement(insertSql);
//stmtInsert.setString(1, pId);
stmtInsert.setString(1, TypeRequisition);
stmtInsert.setString(2, Quantity);
stmtInsert.setString(3, CTC);
//Execute SQL statement
stmtInsert.executeUpdate();
}
}
} catch (Exception ex) {
LogUtil.error("Your App/Plugin Name", ex, "Error storing using jdbc");
} finally {
try {
if (con != null) {
con.close();
}
} catch (Exception ex) {
LogUtil.error("Your App/Plugin Name", ex, "Error closing the jdbc connection");
}
}
}
//Process and store grid rows
saveGridRows(element, rows, formData);