...

Code Block
languagejava
package com.intellectdesign.modelhouse.dataSupport; 
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map; 
import com.intellectdesign.canvas.database.DatabaseConstants;
import com.intellectdesign.canvas.database.DatabaseException;
import com.intellectdesign.canvas.database.DatabaseRequest;
import com.intellectdesign.canvas.database.DatabaseResult;
import com.intellectdesign.canvas.formdefinition.FormDefinitionException;
import com.intellectdesign.canvas.formdefinition.FormItemDefinition;
import com.intellectdesign.canvas.formdefinition.addinfo.AdditionalDataCodeValue;
import com.intellectdesign.canvas.formdefinition.addinfo.IAdditionalDataSupport;
import com.intellectdesign.canvas.value.IUserValue; 

public class PaymentDataSupport implements IAdditionalDataSupport
{ 
	@Override
	public ArrayList<AdditionalDataCodeValue> getAdditionalDataFor(FormItemDefinition itemDefn, IUserValue userValue, HashMap inputParams) throws FormDefinitionException
	{
		ArrayList<AdditionalDataCodeValue> resultList = null;
		DatabaseRequest dbRequest = null;
		DatabaseResult dbResult = null;
		List tmpList = null;
		String key = null;
		
		try
		{
			//Create a DB Request to fetch the Account No from DB to the combo 
			dbRequest = new DatabaseRequest();
			dbResult = new DatabaseResult();
			tmpList = new ArrayList();
			resultList = new ArrayList<AdditionalDataCodeValue>();
			dbRequest.setDataSource(DatabaseConstants.DEFAULT_DATASOURCE); 

			//Getting the data for the Debit Account No combo
			if (itemDefn.getItemId().equals("ACC_NO"))
			{
				dbRequest.setOperation(DatabaseConstants.SELECT); 
				// Actual result map key, which contains the SQL to be executed
				dbRequest.setDataAccessMapKey("FUNDTRANS");
				dbRequest.setOperationExtension("ACC_NO");
				dbResult = dbRequest.execute(); 
				key = "ACCOUNT_NO"; 
				tmpList = dbResult.getReturnedList(); 
			} else if (itemDefn.getItemId().equals("BENE_ACC_NO"))
			{
				dbRequest.setOperation(DatabaseConstants.SELECT);
				dbRequest.setDataAccessMapKey("FUNDTRANS");
				dbRequest.setOperationExtension("BENE_NO");
				dbResult = dbRequest.execute();
				key = "BENE_ACC_NO";
				tmpList = dbResult.getReturnedList();
			}
			for (int i = 0; i < tmpList.size(); i++)
			{
				Map tmpMap = (HashMap) tmpList.get;
				resultList.add(new AdditionalDataCodeValue((String) tmpMap.get(key), (String) tmpMap.get(key)));
			}
		} catch (DatabaseException dbExcep)
		{
			throw new FormDefinitionException(dbExcep);
		}
		return resultList;
	}
} 

Now, create a Select SQL result map in SQLMap file to get the data from the database for the access map key.

...

Code Block
languagesql
<! Debit Account Number selection SQL Extension value as SELECT_ACC_NO----------------------------> 
	<selectid="FUNDTRANS_SELECT_ACC_NO"resultMap="FUNDTRANS_SELECT_ACC_NO_RESULT_MAP">
		select ACCOUNT_NO from ACCOUNT_SUMMARY_DATA
	</select> 
<! Debit Account Number selection SQL Extension value as SELECT_ACC_NO---> 
	<selectid="FUNDTRANS_SELECT_BENE_NO"resultMap="FUNDTRANS_SELECT_BENE_NO_RESULT_MAP">
		select BENE_ACC_NO from BENE_DATA where PAYMENT_TYPE='Domestic Fund Transfer'
	</select>

...

Code Block
languagejs
registerHandlers : function ()
	{
		this.fm.registerHandler("cbxchange","TXT_DBIT_AC_NO", function (fm, event, fieldName, value)
	{
		if(!cbx.isEmpty (value))
			{
				var paramsOb =
					{
						"INPUT_ACTION" : "GET_ACC_DTLS",
						"INPUT_FUNCTION_CODE" : "VSBLTY",
						"INPUT_PRODUCT" : "PAYMNT",
						"INPUT_SUB_PRODUCT" : "BKSIFT",
						"PAGE_CODE_TYPE" : "ACC_CODE",
						"PRODUCT_NAME" : "PAYMNT",
						"ACCOUNT_NO" : value
					};
			cbx.ajax(
			{
				params : paramsOb,
				success : function (result, request)
				{
					fm.model.setValue('TXT_DBIT_AC_NAME', (response.ACC_NAME||
					response.ACCOUNT_NAME||""));
				},
				scope :this
			}); 
		}
	}); 
	
	/* this.fm.registerHandler("cbxchange","TXT_BEN_AC_NO", function (fm, event,fieldName, value){
	}); */ 
} 


Similarly, create a change event for the TXT_BEN_AC_NO combo and get the data through Action Class > Handler Class > Instruction Class > SQL Map from the database.