You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Deepak MS <me...@gmail.com> on 2013/07/15 15:21:00 UTC
Flex AIR SQLite response
Hello,
I am working on flex mobile app with sqlite db. Whenever a query is
executed in a sqlite manager tool, I get a response with a set of products
as a first column and latest 12 months as rest of the columns which gives
the sales data(columns are sorted within the query to give latest 12 months
in order) :
Products, Jul 2013, Jun 2013, May 2013 , Apr 2013 , Mar 2013, Feb 2013, Jan
2013, Dec 2012, Nov 2012, Oct 2012, Sep 2012, Aug 2012
But when I execute this same query in my app, I get the response with
column names sorted:
Apr 2012, Aug 2012, Dec 2012, Feb 2013, Jan 2013, Jul 2013, Jun 2013, Mar
2013, May 2013, Nov 2012, Oct 2012, Products, Sep 2012
But I need to display the data in same order as I get it from the query.
>From this response, I am again looping and sorting based on months to
display as desired.
Can you kindly let me know if there is any property we can set or a way to
get the response as-is, without sorting it? With this, I want to avoid
looping. I tried searching for it, but did not get much help on net.
Appreciate your help…
Warm regards,
Deepak
RE: Flex AIR SQLite response
Posted by Kessler CTR Mark J <ma...@usmc.mil>.
I've run into the problem of having default sorting done to list collections that I've applied an empty collections.sort to. It is very annoying if you've ordered the data on the server side and then the view shows it ordered using its default internal comparison.
You could try to read the data after you get it... but before you assign it to be a dataProvider/sorting/filtering.
I have it on my todo list to take a look at having it restore the original order sometime.
-Mark
-----Original Message-----
From: Deepak MS [mailto:megharajdeepak@gmail.com]
Sent: Tuesday, July 16, 2013 6:28 AM
To: users@flex.apache.org
Subject: Re: Flex AIR SQLite response
Yeah, I did try mentioning the columns' order in query itself, but no luck.
It still sorts alphabetically all the time(I tried out around 15 different
queries with multiple columns). I'm not quite sure if its general database
issue, since I tried to run those queries in ms sql and sqlite tools, I get
the columns ordered as mentioned in my query. But in flex, no matter what
order I mention or even when I give a *, it just sorts alphabetically.
However, I am picking up the first row and looping to get the column names,
sorting the columns and again rebuilding the data table to display. This
whole process on device is taking time as I have around 200 columns(which
are dynamic) that come from query.
Had I got the query result without being sorted, I could have directly used
it and could have avoided the above step. Kindly let me know if there is
any other alternative for the step mentioned above.
-Deepak
Re: Flex AIR SQLite response
Posted by Deepak MS <me...@gmail.com>.
Yeah, I did try mentioning the columns' order in query itself, but no luck.
It still sorts alphabetically all the time(I tried out around 15 different
queries with multiple columns). I'm not quite sure if its general database
issue, since I tried to run those queries in ms sql and sqlite tools, I get
the columns ordered as mentioned in my query. But in flex, no matter what
order I mention or even when I give a *, it just sorts alphabetically.
However, I am picking up the first row and looping to get the column names,
sorting the columns and again rebuilding the data table to display. This
whole process on device is taking time as I have around 200 columns(which
are dynamic) that come from query.
Had I got the query result without being sorted, I could have directly used
it and could have avoided the above step. Kindly let me know if there is
any other alternative for the step mentioned above.
-Deepak
On Mon, Jul 15, 2013 at 7:17 PM, Justin Mclean <ju...@classsoftware.com>wrote:
> Hi,
>
> SQL column order should never be assumed, there is no way to order columns
> and it could even possibly vary query by query (in practice it doesn't).
> This isn't a Flex issue but a general database issue.
>
> You might be able to select the columns in order by specifying them in the
> select statement in the order you want rather that a select * but it would
> be best to change to code to not rely on the order of the columns.
>
> Justin
Re: Flex AIR SQLite response
Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,
SQL column order should never be assumed, there is no way to order columns and it could even possibly vary query by query (in practice it doesn't). This isn't a Flex issue but a general database issue.
You might be able to select the columns in order by specifying them in the select statement in the order you want rather that a select * but it would be best to change to code to not rely on the order of the columns.
Justin
RE: Flex AIR SQLite response
Posted by Mark Line <ma...@gmail.com>.
I think the best approach would be to modify the sql query to get the
results you want.
EG:
SELECT *
FROM products
ORDER BY dateTimeStamp DESC
-----Original Message-----
From: Deepak MS [mailto:megharajdeepak@gmail.com]
Sent: 15 July 2013 14:21
To: users@flex.apache.org
Subject: Flex AIR SQLite response
Hello,
I am working on flex mobile app with sqlite db. Whenever a query is executed
in a sqlite manager tool, I get a response with a set of products as a first
column and latest 12 months as rest of the columns which gives the sales
data(columns are sorted within the query to give latest 12 months in order)
:
Products, Jul 2013, Jun 2013, May 2013 , Apr 2013 , Mar 2013, Feb 2013, Jan
2013, Dec 2012, Nov 2012, Oct 2012, Sep 2012, Aug 2012
But when I execute this same query in my app, I get the response with column
names sorted:
Apr 2012, Aug 2012, Dec 2012, Feb 2013, Jan 2013, Jul 2013, Jun 2013, Mar
2013, May 2013, Nov 2012, Oct 2012, Products, Sep 2012
But I need to display the data in same order as I get it from the query.
>From this response, I am again looping and sorting based on months to
display as desired.
Can you kindly let me know if there is any property we can set or a way to
get the response as-is, without sorting it? With this, I want to avoid
looping. I tried searching for it, but did not get much help on net.
Appreciate your help.
Warm regards,
Deepak