cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a Query Template as WebService(Flex Application)

Former Member
0 Kudos

Hi all,

This is my Flex application code:

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="Hi()">

<mx:Script>

<![CDATA[

import mx.rpc.events.ResultEvent;

import mx.rpc.http.mxml.HTTPService;

import mx.controls.Alert;

private function Hi():void{

Alert.show("Hello", "Alert Box", Alert.OK);

App1.url=encodeURI("http://localhost/Lighthammer/Illuminator?QueryTemplate=Accenture\SAP_CAP\04_Sandpit\SheetalReddy\Query\Asset_util_query1&IllumLoginName=admin&IllumLoginPassword=admin&content-type=text/xml");

App1.send();

}

]]>

</mx:Script>

<mx:HTTPService id="App1"/>

<mx:LineChart id="linechart1" width="100%" height="60%" dataProvider="{App1.lastResult.Rowsets.Rowset.Row}" x="0" y="0">

<mx:horizontalAxis>

<mx:CategoryAxis categoryField="DateTime"/>

</mx:horizontalAxis>

<mx:series>

<mx:LineSeries displayName="Util1" yField="AssetUtil2" form="curve"/>

</mx:series>

</mx:LineChart>

<mx:Legend dataProvider="" x="10" y="347" fontFamily="Arial" fontSize="13"/>

</mx:Application>

Problem is I am not able populate data from the Query Template into the grid.

I am guessing the problem is either with the "HTTPService" tag or the "dataProvider".

Are there any pre-requisites or any settings to be done before calling a Query through a flex application?

I am clueless.

Kindly help.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Shaira/Sam/Mike:

#1 - you don't need to encode the URI in this case (only when specified as an attribute for the HTTPService element)

#2 - you need to use forward slashes, not back slashes in the QueryTemplate name

#3 - linechart1 isn't a parameter, it is a binding between the chart object and the legend object, and the syntax is correct

#4 - I prefer to use "e4x" format in the HTTPService, and add an XMLListCollection for dynamic binding:

<mx:XMLListCollection id="mydata" source="{YourHttpService.lastResult.Rowset.Row}"/>

...in which case you would change your dataProvider for the chart to

#5 - the initialize action isn't really the best place to trigger the query/http service. I would suggest linking it to the "creationComplete" event on the chart.

Rick

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi all,

Thanks for all the help..

All i had to do was change the backward slashes in the Query Template name to forward slashes.. Was a silly mistake which i hadn noticed..

Cheers,

Shaira

Former Member
0 Kudos

Hi, Shaira.

I would still HIGHLY recommend the other changes to your app (the comment about the parameter was for Sam, not for you).

Those changes will improve the flexibility and capability of your app (using e4x), and I have seen reports of timing issues if trying to do significant work in the 'initialize' event of the app (e.g. timing issues with creation of child and dependent components).

Rick

0 Kudos

Shaira,

Make sure that the file extension for your webpage is .irpt otherwise the session variable will not be properly set.

Sam

agentry_src
Active Contributor
0 Kudos

First thing I would try is changing localhost to the actual computer name.