In this section: How to: |
The ibiDataGrid populates the Flex application with WebFOCUS data. You bind the grid to a WebFOCUS procedure (fex). At run time, when the SWF application is accessed, the procedure is executed and the returned data is loaded into it.
To make the application more visually appealing, you can host the ibiDataGrid in the Flex Builder Panel component.
Regional Detail Transactions
Adjust all four side walls of the ibiDataGrid to fit exactly within the panel. If the grid is wider than the panel, Flex Builder will automatically display scroll bars. See the Flex Builder documentation for instructions on relatively positioning two components.
http://localhost:8080/ibi_apps/WFServlet?IBIF_ex=xmltest
Note: To access the ibiDataGrid custom properties, the Flex Properties panel must be open. To open the Flex Properties panel, select Window then Flex Properties. To the right of the Flex Properties tab are three icons: Standard View, Category View, and Alphabetical View. Select Category View to access the seturl property, which is listed under IBI Data.
See your WebFOCUS Developing Reporting Applications manual for information on the required parameters for a URL that runs a procedure.
<mx:Panel x="308" y="10" width="467" height="195" layout="absolute" title="Regional Detail Transactions" backgroundColor="#c0c0c0"> <ibi:ibiDataGrid x="0" y="0" width="447" height="155" id="MAIN01"> <ibi:seturl>http://localhost:8080/ibi_apps/WFServlet?IBIF_ex=xmltest </ibi:seturl> </ibi:ibiDataGrid> </mx:Panel>
In this section: |
Information Builders XML parser will be used by Information Builders components, instead of the one provided by Adobe. This change will not affect interactions with Adobe components. If you require the Adobe XML parser, change the ibiUseXMLParser property to true.
The property called ibiDataSendMethod is available in ibiDataGrid to support the use of HTTP POST to retrieve data from a long URL in seturl value. If nothing is specified for this property, POST is the default method used for retrieving data from WebFOCUS. There are cases where HTTP GET needs to be used instead, especially when the URL does not require a Servlet call, for example, to simply retrieve the data from a static XML file posted on the web site. Please see HTTP Method Definitions specified by the W3C Organization for more details.
To apply a send method, use the following syntax.
ibiDataSendMethod="send_method"
where:
If the seturl is specified to simply retrieve the data from the XML file posted on the website you need to set ibiDataSendMethod property to GET, as shown in the following example.
<ibi:ibiDataGrid x="21" y="672" width="593" id="mainGrid" seturl="http://flexdemo.ibi.com/examples/bamsample.xml?" ibiAddRandom="true" ibiUseFiltered="true" ibiDataSendMethod="GET" />
When the seturl property contains a valid URL to a WebFOCUS procedure but there is no data returned because no data exists, an empty data grid will be returned at the run-time without error. The Data Error message will be displayed in the message window if there is a problem locating the procedure or the server.
The following properties are available in ibiDataGrid to change the sort order of the columns.
Property |
Description |
---|---|
ibiDefaultSort |
Specify the column name to sort on. |
ibiDefaultSortOrder |
Specify the sort order to be either ascending or descending. The values accepted are: ASCE or DESC. |
If the user changes the sort order during run time, these values will be overwritten.
In addition to loading data using a WebFOCUS URL, data can be embedded into a .SWF file that is Adobe Flash Player compatible. Using Flex Builder, you can safely store data in XML directly in your SWF file that is Adobe Flash Player compatible if you wish to avoid loading it at run time.
Flex needs physical access to the XML file, so it needs to be saved into the Flex Builder project \src folder. Typically, the project folder will be located in: Drive Letter:\Documents and Settings\user_id\My Documents\Flex Builder 3\project_name\.
You can create an XML representation of data using HOLD FORMAT instead of PCHOLD FORMAT in WebFOCUS and by specifying the XML file saved in the ActionScript section of the source mxml file in your flex application, using the following code:
[EMBED(source="filename.xml")]
where:
Note: For embedded data, seturl element must be set as internal.
By using HOLD FORMAT XML instead of PCHOLD FORMAT XML, ggsales.xml is the output of the xmltest procedure.
<?xml version="1.0" encoding="utf-8"?> <mx:Application creationComplete="init()" xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:ibi="*"> <ibi:ibiCanvas x="10" y="10" width="800" height="600"> <ibi:ibiDataGrid x="20" y="20" height="400" width="600" id="MAIN01"> <ibi:seturl>internal</ibi:seturl> </ibi:ibiDataGrid> </ibi:ibiCanvas> <mx:Script> <![CDATA[ [Embed(source="ggsales.xml",mimeType="application/octet-stream")] public static const XMLFILE:Class; public static const embededXML:XML = setConst(); private static function setConst():XML { var ba:ByteArray = new XMLFILE() as ByteArray; return new XML(ba.readUTFBytes(ba.length)); } private function init():void { MAIN01.iArray.myXML = embededXML; } ]]> </mx:Script> </mx:Application>
Note: To embed data in XML files that contain encoding other than UTF-8, you may need to replace the following code from the above sample:
return new XML(ba.readUTFBytes(ba.length));
with:
return new XML(ba.readMultiByte(ba.length,"charSet_Name"));
where
WebFOCUS |