You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Current »

Hi,

i want to copy an exactly grid form but from a different form, and in this new grid form i'm adding a new column.

right now my code is like this:

import org.joget.apps.form.model.*;

import org.joget.apps.form.service.*;

import java.sql.*;

import org.apache.commons.collections.SequencedHashMap;

import java.util.*;



public FormRowSet test() {

	FormRowSet f = new FormRowSet();

	Class.forName("com.mysql.jdbc.Driver").newInstance();

	con = DriverManager.getConnection("jdbc:mysql://localhost:3306/jwdb?characterEncoding=UTF-8", "root", " ");



	if(!con.isClosed()){

		String recordId = "#form.eStationary_request.field1#"; // Get the url parameter

		String sql = "SELECT c_item FROM app_fd_eStationary_request WHERE id=?"; // Here you can query from one or multiple tables using JOIN etc

		PreparedStatement stmt = con.prepareStatement(sql);

		stmt.setString(1, recordId);

		ResultSet rs = stmt.executeQuery();

		while (rs.next()) {

		FormRow r1 = new FormRow();

			r1.put("item_quantity", rs.getString(1));

			r1.put("item_desc", rs.getString(2));

			f.add(r1);

	   }

	}

	return f;

}

return test();

it doesn't seems to work. i obtained this code from here, : Load & Store Form Grid Data Using Bean Shell Form Binder

Hope someone can help me with this... need help!...

Regards,

N.aimi F

  • No labels