cancel
Showing results for 
Search instead for 
Did you mean: 

Execute Query to use XML result in webpage

Former Member
0 Kudos

Hi,

I have a web page which will use the dHTMLx class to create an editiable grid.

Howeever, what I would like to know is how do I execute the relevant MII query from the webpage and use the XML result on the editable grid.

Thanks

Martin

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Martin,

If you calling query from your page you can use following options with query.

Content-type=text/html

Content-type=text/xml

Content-type=text/csv

The second option will return the data in xml format.

but however the javascript frameworks like dojo,jquery or dHTMLx use some specific format either

xml, json or sometime html.

You can use inline transform in query template to convert your query output to to convert specific format.

Check these blogs

/people/avijit.dhar3/blog/2010/11/09/using-dojo-editable-grid-as-an-alternate-to-standard-mii-igrid

/people/musarrat.husain2/blog/2011/06/08/charts-for-mobile-devices-using-flot-and-xslt

in blogs they are using dojo and flot frameworks, but the same approach will work for your requirement as well.

Thanks

Anshul

Former Member
0 Kudos

In DHTMLx you have these options to load data


        grid.loadXML(url)                       // load data from a remote file
        grid.loadXMLString(string);          // load data from a JS string
        grid.parseXML(object);               // load data from an XML object (xmlhttprequest or XML island)
 
 
 
        grid.loadCSV(url)                       // load data from a remote file;
        grid.loadCSVString(string);          // load data from a JS string

you can use all of them but i guess the 1st one is the easiest.

Just call query template using url and with method content-type=text/xml


http://<server:port>/XMII/Illuminator?QueryTemplate=<QueryTemplate Path>&Param.1=<Param Value>...&Content-Type=text/xml

include your inline transformation in query to change data in specific format

Regards

Anshul

Former Member
0 Kudos

Hi,

I was already trying what you have suggested but I am getting an error with the xHTMLd method to load the data.

The XML that my URL returns is: -

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

- <Rowsets DateCreated="2011-09-10T18:36:54" EndDate="2011-09-10T18:36:54" StartDate="2011-09-10T17:36:54" Version="12.1.7 Build(47)">

- <Rowset>

- <Columns>

<Column Description="" MaxRange="0" MinRange="0" Name="xmlOutput" SQLDataType="1" SourceColumn="xmlOutput" />

</Columns>

- <Row>

<xmlOutput><?xml version="1.0" encoding="UTF-8"?> <rows> <row> <cell>Div1</cell> <cell>Site1</cell> <cell>Room1</cell> <cell>Machine1</cell> <cell>Week</cell> <cell>50</cell> <cell>10</cell> <cell>kwh</cell> </row> <row> <cell>Div1</cell> <cell>Site1</cell> <cell>Room1</cell> <cell>Machine2</cell> <cell>Week</cell> <cell>2</cell> <cell>10</cell> <cell>kwh</cell> </row> <row> <cell>Div1</cell> <cell>Site1</cell> <cell>Room1</cell> <cell>Machine3</cell> <cell>Week</cell> <cell>3</cell> <cell>10</cell> <cell>kwh</cell> </row> </rows></xmlOutput>

</Row>

</Rowset>

</Rowsets>

I have ran a test on the xHTMLd passing in the hardcoded XML within my page. The XML I used was

<?xml version="1.0" encoding="UTF-8"?> <rows> <row> <cell>Div1</cell> <cell>Site1</cell> <cell>Room1</cell> <cell>Machine1</cell> <cell>Week</cell> <cell>50</cell> <cell>10</cell> <cell>kwh</cell> </row> <row> <cell>Div1</cell> <cell>Site1</cell> <cell>Room1</cell> <cell>Machine2</cell> <cell>Week</cell> <cell>2</cell> <cell>10</cell> <cell>kwh</cell> </row> <row> <cell>Div1</cell> <cell>Site1</cell> <cell>Room1</cell> <cell>Machine3</cell> <cell>Week</cell> <cell>3</cell> <cell>10</cell> <cell>kwh</cell> </row> </rows>

However, when I specify a URL to use to load the data, you can see that the XML does not match exactly with what I have tested .

Thanks

Martin

Former Member
0 Kudos

Hi ,

Are you generating your XML format direct from database query?

The SQL query output is not in the format of xHTMLd input. because it also containing Rowset, Row and Column Structure.

Use grid.loadXMLString(string);

and Just extract xmlOutput Node of your xml by using DOM or string manipulation.

One Suggestion, dont generate XML format in database itself. Use inline transform instead.

Its quite powerful.

Gud Luk

Anshul

Former Member
0 Kudos

Hi,

my query executes a transactions which extracts the data and then runs a transformation. However, the result from the query also contains these additional tags which I presume are making my xHTMLd to fail.

I was also trying to execute my MII query via a httpRequest from my web page but I keep getting issues with user ID and password. I cannot seem to pass these parametes in corectly to the httpRequest. Have you ever done this before.

Thanks

Martin

Former Member
0 Kudos

Hi

You are using Xacute query to call transaction

So are you using Inline transform in Transaction or in the Xacute Query.

Xacte query will always generate the xml output in Rowset format.

Change your inline transformation form transaction to xacute query.

Second,

Is your page outside MII project.

If it is, then Pass username and password with the url.

because it can not access your mii session.

Pass two additional parameters illumLoginName=<LoginName>

and illumLogninPassword=<password>

I have not worked with xHTMLd but i have worked on couple of scenarios like this.

Thanks

Anshul

Former Member
0 Kudos

Hi ,

The Xacute query executes a transactions which invokes an XLS file to translate the data.

I have amended the URL to pass in the user ID and password.

I am still having issues in getting the response back from my HTTPRequest. Do you have any example javascript which you have seen to execute such a query.

Thanks

Martin

Former Member
0 Kudos

HI

Check These examples

/people/abesh.bhattacharjee/blog/2007/03/05/ajax-xmii-illuminator-services-a-database-browser

/people/srinivaskumar.mupparshetty/blog/2011/05/25/ajax-enabled-dynamic-editable-data-grid-using-servlet-and-xsl-in-mii

i am getting some error while posting my code here.