4-Sep-03 (Created: 4-Sep-03) | More in 'Data Access'

05.13 Obtaining an 'ihds' data set from Aspire

Goal - Get a hierarchical data set from Aspire

This article will demonstrate the following

  1. Come up with a symbolic name for your data set
  2. Create a properties file section for that symbolic name
  3. Retrieve the data set in java
  4. Example properties file for data set with only main data
  5. Example properties file for data set with a main data set and one loop
  6. Example properties file for data set with a main data set and two sibling loops
  7. Example properties file for data set with a main data set and one loop and one sub loop

Step1 - Come up with a symbolic name for your data set

Let us call the symbolic name "ihdsTest"

Step2 - Define a properties file


request.ihdsTest.className=com.ai.htmlgen.DBHashTableFormHandler1

#Main data request
request.ihdsTest.maindatarequest.className=com.ai.db.DBrequestExecutor2
request.ihdsTest.maindatarequest.db=(my-db-alias)
request.ihdsTest.maindatarequest.stmt=(my sql statement)

#it has one loop called "works"
request.ihdsTest.loopNames=works

#Loop data section for "works"

request.ihdsTest.works.class_request.className=com.ai.htmlgen.GenericTableHandler6
request.ihdsTest.works.query_request.className=com.ai.db.DBRequestExecutor2
request.ihdsTest.works.query_request.db=(my-db-alias)
request.ihdsTest.works.query_request.stmt=(select statement)

Step3 - Obtain ihds and use it in java



	ihds hds = null;
	try
	{
		Hashtable args = new Hashtable();
		args.put("key1".toLowerCase(), "value1");

		IFactory factory = AppObjects.getFactory();
		ihds hds         = (ihds)factory.getObject("ihdsTest",args);
		//use ihds accroding to the api
	}
	finally
	{
		//finally close it when you are done
		if (hds != null)
			hds.close();
	}

Example properties file for data set with only main data


request.ihdsTest.className=com.ai.htmlgen.DBHashTableFormHandler1

#Main data request
request.ihdsTest.maindatarequest.className=com.ai.db.DBrequestExecutor2
request.ihdsTest.maindatarequest.db=(my-db-alias)
request.ihdsTest.maindatarequest.stmt=(my sql statement)

Example properties file for data set with a main data set and one loop


request.ihdsTest.className=com.ai.htmlgen.DBHashTableFormHandler1

#Main data request
request.ihdsTest.maindatarequest.className=com.ai.db.DBrequestExecutor2
request.ihdsTest.maindatarequest.db=(my-db-alias)
request.ihdsTest.maindatarequest.stmt=(my sql statement)

#it has one loop called "works"
request.ihdsTest.loopNames=works

#Loop data section for "works"

request.ihdsTest.works.class_request.className=com.ai.htmlgen.GenericTableHandler6
request.ihdsTest.works.query_request.className=com.ai.db.DBRequestExecutor2
request.ihdsTest.works.query_request.db=(my-db-alias)
request.ihdsTest.works.query_request.stmt=(select statement)

Example properties file for data set with a main data set and two sibling loops


request.ihdsTest.className=com.ai.htmlgen.DBHashTableFormHandler1

#Main data request
request.ihdsTest.maindatarequest.className=com.ai.db.DBrequestExecutor2
request.ihdsTest.maindatarequest.db=(my-db-alias)
request.ihdsTest.maindatarequest.stmt=(my sql statement)

#it has one loop called "works"
request.ihdsTest.loopNames=works,works2

#Loop data section for "works"

request.ihdsTest.works.class_request.className=com.ai.htmlgen.GenericTableHandler6
request.ihdsTest.works.query_request.className=com.ai.db.DBRequestExecutor2
request.ihdsTest.works.query_request.db=(my-db-alias)
request.ihdsTest.works.query_request.stmt=(select statement)

#Loop data section for "works2"

request.ihdsTest.works2.class_request.className=com.ai.htmlgen.GenericTableHandler6
request.ihdsTest.works2.query_request.className=com.ai.db.DBRequestExecutor2
request.ihdsTest.works2.query_request.db=(my-db-alias)
request.ihdsTest.works2.query_request.stmt=(select statement)

Example properties file for data set with a main data set and one loop and one sub loop


request.ihdsTest.className=com.ai.htmlgen.DBHashTableFormHandler1

#Main data request
request.ihdsTest.maindatarequest.className=com.ai.db.DBrequestExecutor2
request.ihdsTest.maindatarequest.db=(my-db-alias)
request.ihdsTest.maindatarequest.stmt=(my sql statement)

#it has one loop called "works"
request.ihdsTest.loopNames=works

#Loop data section for "works"

request.ihdsTest.works.class_request.className=com.ai.htmlgen.GenericTableHandler6
request.ihdsTest.works.loopNames=childloop1
request.ihdsTest.works.query_request.className=com.ai.db.DBRequestExecutor2
request.ihdsTest.works.query_request.db=(my-db-alias)
request.ihdsTest.works.query_request.stmt=(select statement)

#Loop data section for subloop called "childloop1" of "works"

request.childloop1.class_request.classname=com.ai.htmlgen.GenericTableHandler6
request.childloop1.query_request.classname=com.ai.db.DBRequestExecutor2
request.childloop1.query_request.db=(my-db-alias)
request.childloop1.query_request.stmt=(select statement)