Re: [flexcoders] Storing an array in a Database?

2009-05-16 Thread Howard Fore
I usually don't deal with in Flex, I pass the array to my backend and
let it loop over it. What's your backend here (what's doing the insert
into the db)?

But I think the root of your problem is that you don't have any record
id values in your array to tell the db where to put the values. My
normal approach for this is to not use arrays of strings, integers,
etc. but arrays (arraycollections actually) of objects. The objects
have some unique identifier(s) that can be used with the database.

Howard

On Friday, May 15, 2009, Laurence MacNeill lmacne...@comcast.net wrote:
 At 06:26 PM 5/15/2009, you wrote:


How that is different from a database table with 25 rows?

 Because it just is.  LOL  With 25 rows, you have 25 separate
 records.  This is 25 columns within a single record.  There are other
 columns too, not just these 25.


You populate your array from that table, use the array as a
datProvider and save changed data back to db. Am I missing something here?


 I'm missing something here, obviously -- I have no clue how to do
 what you just said.

 My problem is, I want to reference each demoX column in the database
 using something like array notation: 'demo[i]' where i is in a
 for-loop from 1 to 25.

 But you can't reference database columns that way -- you have to use
 hard-coded strings.  (ok, I don't know how to do it *without* using
 hard-coded strings, let me put it that way.)

 So how do I for-loop my way through that?  Maybe I'm not explaining
 myself well.  But I don't know how else to explain it.

 L.



--- In
mailto:flexcoders%40yahoogroups.comflexcoders@yahoogroups.com,
Laurence MacNeill lmacne...@... wrote:
 
  Ok, I think maybe I'm over-thinking this and confusing myself... But
  how do I store an array in a Database?
 
  I have an array 'demographics[]' with 25 elements in it (0 thru
  24). I can certainly use a for-loop to loop through each element and
  do whatever I want with each element. But when it comes to storing
  them in the database, I'm at a loss. I have 25 strings in the DB,
  named demo1, demo2, ... demo25. I can't access them using the same
  type of for-loop syntax that I'm using to access my array, so how do
  I copy the array into the database? And read it back out again?
 
  Is there no choice but to do something like this:
  my.DB.reference.demo1 = demographics[1];
  my.DB.reference.demo2 = demographics[2];
  ...
  my.DB.reference.demo25 = demographics[25];
 
 
  That seems terrible, but it's the only way I've figured out how to do
  it so far. There's GOT to be a better way. Please help.
 
 
  Laurence MacNeill
  Mableton, Georgia, USA
 



No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.329 / Virus Database: 270.12.31/2116 - Release Date:
05/15/09 06:16:00



 

 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Alternative FAQ location: 
 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
 Search Archives: 
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links





-- 
--
Howard Fore, howard.f...@hofo.com
The universe tends toward maximum irony. Don't push it. - Jeff Atwood


[flexcoders] Storing an array in a Database?

2009-05-15 Thread Laurence MacNeill
Ok, I think maybe I'm over-thinking this and confusing myself...  But 
how do I store an array in a Database?

I have an array 'demographics[]'  with 25 elements in it (0 thru 
24).  I can certainly use a for-loop to loop through each element and 
do whatever I want with each element.  But when it comes to storing 
them in the database, I'm at a loss.  I have 25 strings in the DB, 
named demo1, demo2, ... demo25.  I can't access them using the same 
type of for-loop syntax that I'm using to access my array, so how do 
I copy the array into the database?  And read it back out again?

Is there no choice but to do something like this:
 my.DB.reference.demo1 = demographics[1];
 my.DB.reference.demo2 = demographics[2];
 ...
 my.DB.reference.demo25 = demographics[25];


That seems terrible, but it's the only way I've figured out how to do 
it so far.  There's GOT to be a better way.  Please help.


Laurence MacNeill
Mableton, Georgia, USA