2007年10月14日 星期日

Development of an IAL Object(Samples)

Development of an IAL-Object consists of the following steps.

  1. Decide which data is required from the application
  2. Create an .ial-file that defines this object
  3. Deploy the object using Sql File Executor.
  4. Set security using Security-tool, making it available to the end user
IAL Objects should be developed for access through any client based reporting tool.
This is how an .ial-file may look. Example taken from Foundation1 Demo application

-----------------------------------------------------------------------------
-- Component:

-- Purpose:
-- IFS/Design Template

-- Date Sign History
-- ------ ---- -----------------------------------------------------------
--
-----------------------------------------------------------------------------
define OBJECT = CUSTOMERS
define MODULE = INVADER
define AO = &AO
-----------------------------------------------------------------------------
------------------------ OBJECT REGISTRATION -------------------------
-----------------------------------------------------------------------------
-- Disable to be able to redeploy objects
begin
&AO..IAL_Object_API.Disable('&OBJECT');
end;
/
-----------------------------------------------------------------------------
------------------ VIEW FOR SELECTS ------------------------------------
-----------------------------------------------------------------------------
PROMPT Creating &OBJECT view
CREATE OR REPLACE VIEW &OBJECT._IAL AS
SELECT co.company_id Company,
co.name Company_Name,
cu.customer_id Customer_No,
cu.name Name,
cu.address Address,
cu.city City,
cu.phone Phone_No,
cu.type Type,
cu.total_order_value Tot_Order_Value,
cu.invoice_value Tot_Invoice_Value
FROM &AO..DEMO_COMPANY CO, &AO..DEMO_CUSTOMER CU
WHERE CU.COMPANY_ID = CO.COMPANY_ID
WITH read only;
GRANT SELECT ON &OBJECT._IAL TO &AO WITH GRANT OPTION
/
-----------------------------------------------------------------------------
--------------- TABLE FOR WAREHOUSE ---------------------------------
-----------------------------------------------------------------------------
CREATE TABLE &OBJECT._TAB
TABLESPACE &ial_data STORAGE (&normal)
AS ( SELECT * FROM &OBJECT._IAL WHERE 1=2 )
/
ALTER TABLE &OBJECT._TAB ADD (
CONSTRAINT &OBJECT._PK
PRIMARY KEY (COMPANY, CUSTOMER_NO)
USING INDEX TABLESPACE &ial_index STORAGE (&normal))
/
GRANT SELECT ON &OBJECT._TAB TO &AO
/
-----------------------------------------------------------------------------
--------------- OBJECT REGISTRATION ----------------------------------
-----------------------------------------------------------------------------
begin
&AO..IAL_Object_API.Enable('&OBJECT');
end;
/