The Daily Click ::. Forums ::. Klik Coding Help ::. Outputting data from an array into an Excel spreadsheet?
 

Post Reply  Post Oekaki 
 

Posted By Message

KevinHaag



Registered
  28/01/2005
Points
  266

VIP Member
5th November, 2008 at 06:55:32 -

Is there a way to output the data in an array (MMF2 Developer) to a file that can be opened in Excel? It could be a .XLS or .CSV

 
Image
http://www.kevinhaag.ca

nim



Registered
  17/05/2002
Points
  7234
5th November, 2008 at 07:03:05 -

I don't think there's an automatic way of doing it, but I'm sure you could write a bit of nifty code that would write the contents of the array into an editbox, separated by commas. If you need any more help, please give us a bit of information about your array (dimensions, 0 or 1 based, what it's used for)

 
//

KevinHaag



Registered
  28/01/2005
Points
  266

VIP Member
5th November, 2008 at 07:11:16 -

Well I can give you a description of the application I'm trying to use it for:

I'm trying to build an app that customers can enter their information in (Name, address, phone number, etc.). I want the data to be able to be accumulated in a file somewhere on the harddrive not accessable to the customer, so that when a new customer comes along, they can enter their data and have it filled in below the previous customer's data.

I want the owner to be able to access the accumulated data at the end of the day, and then press a button and have it export into an organized spreadsheet.

It doesn't have to be an array, just whatever will work.

 
Image
http://www.kevinhaag.ca

nim



Registered
  17/05/2002
Points
  7234
5th November, 2008 at 07:24:01 -

Sounds like you're making a database. There used to be an ODBC extension for MMF1.5 but I don't think it was updated for MMF2. The Dynamic Array object can save as .csv. It's not the xls solution you're looking for, though.

http://ext.neatwares.ath.cx/ext/Dynamic_Array

 
//

KevinHaag



Registered
  28/01/2005
Points
  266

VIP Member
5th November, 2008 at 08:33:22 -

Okay I have the ODBC extension in MMF2, and it seems to be exactly what I'm needing. I need to output the form data in a specific format though:

'NAME','AGE','COUNTRY'

Now say I have 3 edit objects. 1 for each: Name, age, and country. Now say, when I press a button, I want a 4th edit object to display a compound of all the edit objects in the new format. For example, I have these fields:

[Bob ]
[63 ]
[Canada]

I want a 4th field to display:

['Bob','63','Canada']

How would I do this?






 
Image
http://www.kevinhaag.ca

nim



Registered
  17/05/2002
Points
  7234
5th November, 2008 at 09:08:08 -

Good to see that the ODBC object is working.

To make a compound editbox, use:

Edittext$("name1") + Edittext$("name2")

Edit:


"['"+Edittext$( "Edit Box" )+"','"+Edittext$( "Edit Box 2" )+"','"+Edittext$( "Edit Box 3" )+"']"


Image Edited by the Author.

 
//

-J-



Registered
  05/10/2008
Points
  228

VIP MemberThe Cake is a Lie
5th November, 2008 at 10:13:29 -

Hey I came across this problem not long ago. I'm using dynamic array object to save my array as a csv file. The problem is that with Dynamic array, to get a value you can't use just X and Y coordinates to find it because it structures the array in one single line instead of a grid. This can be a problem because when you open it in Excel, it isn't displayed in a grid form but as a single long line of values. So say if you a 5 x 5 dynamic array, and wanted to read a value from the cell X4, Y3. The thing is that this is actually found by getting a value from "cell 14"... I think I had a formula for working out stuff like this.. I think it was:

Get value at ((Y-1)*C)+X

Where Y was the number of the row you wanted, X was the number of the column you wanted, and C was the total amount of columns in the array, which was 5 in this case. So:

Get value at ((3-1)*5)+4 Which equals 14, and by changing X and Y you can get the value from any cell in this array.

If you set the Dimension Boundary 1 to whatever X size array you want it will appear in grid structure in Excel I think.


Lol that kind of over-answers your question but I hope it helps



 
n/a ...
   

Post Reply



 



Advertisement

Worth A Click