Link to home
Start Free TrialLog in
Avatar of SreeramojuPradeep
SreeramojuPradeepFlag for India

asked on

Generate xml from sqlite database table for air application

Hi,

Can u let me know is it possible to generate xml based on our requirement from sqlite database table for air application and how????

Thanks & Regards
Avatar of dgofman
dgofman
Flag of United States of America image

Avatar of SreeramojuPradeep

ASKER

But that is through command prompt...
 how about sqlite...??

Select * from Scheduler for xml auto

The query is not running in sqlite browser....
It will be close to MySQL syntax

For this table structure

"INSERT INTO test_table (first_name, last_name) VALUES('FIRST', 'LAST')";

SQL statment is:

var sqls:SQLStatement = new SQLStatement();
sqls.addEventListener(SQLEvent.RESULT, result);
sqls.text = "SELECT GROUP_CONCAT('<first>' || first_name || '</first><last>' || last_name || '</last>', '\n') AS xml FROM test_table";
sqls.execute();

Function handler is:

private function result(e:SQLEvent):void
{
      var data:Array = sqls.getResult().data;
      if(data != null && data.length == 1)
           trace(data[0].xml);
}
I tried running the same query in sqlite browser but its not working.....i.e its going into Not Responding stage...

can u pls let me know what changes i have to do......
Hi dgofman,

Its working fine....since i was directly checking this from sqlite browser...it was reaching into not responding state....Thanks for that....

If suppose a table has following fields...

EmpName
EmpPhone
EmpEmail...

I will generate xml for this table...

But i would like to populate the same in dropdown menu...

A drop down menu will consist of All EmpName..
Once the user select a particular EmpName it should dropdown side menu showing EmpPhone of that employee and once he selects EmpPhone the side menu should display EmpMail if it exists only...




can u let me know how to use distinct for the above query......
Create Bindable variable

[Bindable]
private var xmlList:XMLList;

Modify my result function

if(data != null && data.length == 1){
     xmlList = new XMLList(data[0].xml);
}

and create a ComboBox

<mx:ComboBox labelField="EmpName" dataProvider="{xmlList}"/>
Hi,

But my requirement is liittle diff...

I have created a test table....

 
Create table ClientDetails(ClientName Text, ComplaintType Text);

Open in new window


I have some dummy records....
 User generated image
The data is retrived from as xml....

The same data is populated to menu  dropdown....
i.e on click of a button the menu drop down with
xyz initially
on mouse over side menu opens up and displays
Crime
Civil

i.e in the below fashion
 
xyz----->Crime
               Civil
abc------->Dowry
pqr-------->complain

Open in new window


Implementing this way can be done.....
Past me XML what you are expecting will be easier for me to understand
?xml version="1.0" standalone="yes" ?> 
<DATAPACKET Version="2.0">
<ROWDATA>
  <ROW CLIENT_ID="1" CASE_TYPE="test" CLIENT_NAME="test"/> 
  <ROW CLIENT_ID="2" CASE_TYPE="crime"CLIENT_NAME="test"/> 
  <ROW CLIENT_ID="3" CASE_TYPE="murder" CLIENT_NAME="Manu"/> 
  <ROW CLIENT_ID="4" CASE_TYPE="RealEstate" CLIENT_NAME="Pradeep" /> 
  <ROW CLIENT_ID="5" CASE_TYPE="Criminal" CLIENT_NAME="Pradeep"/>
</ROWDATA>
</DATAPACKET>

Open in new window


1. i would like to select all distinct client names display in menu dropdown..once user mouse over on
client name a side menu opens which display all case type wrt that client name....

The concept is to display distinct client names with
case types available wrt to that client...........
ASKER CERTIFIED SOLUTION
Avatar of dgofman
dgofman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Once i get the table data in xml format....
i would like to give this data has dataprovider to dropdown menu..

which initially displays
Main menu                                  SideMenu
-----------------------------------------------------------------------------------                    
Distinct client names only......
CLIENT_NAME1-------------CASE_TYPE related to CLIENT_NAME1
CLIENT_NAME2--------------CASE_TYPE related to CLIENT_NAME2

Can u let me know how to get the output in the above format......which is simple has drop down menu....pls this requirement is badly in need.....
Is there any other way using which i can get the output in the above way......
You have to open a new question how to retrive XML data in drop down menus
I answered on your question sqllite to XML
I have opened a new question....can u pls provide me the solution ASAP.....