Exporting live .csv file to use in Processing?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
kgil05
Posts: 2
Joined: Fri Apr 29, 2016 12:39 pm

Exporting live .csv file to use in Processing?

Post by kgil05 » Fri Apr 29, 2016 12:46 pm

Hi there,

I'm currently developing a desktop app that will allow users to have conversations within a data grid. I want to be able to export this data in real tiime to then run in processing to create a live data visualisation. Is this possible? and can someone point me in the right direction?

thanks,

Katy :)

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Exporting live .csv file to use in Processing?

Post by Klaus » Fri Apr 29, 2016 1:08 pm

Hi Katy,

1. welcome to the forum! :D

2. Can you provide a bit more info?
I want to be able to export this data in real time...
Do you mean to write the content of the datagrid to a file right after the user has entered some data into the datagrid?

I guess the datagrid is of type TABLE, right?

Code: Select all

...to then run in processing to create a live data visualisation
Also with Livecode?


Best

Klaus

kgil05
Posts: 2
Joined: Fri Apr 29, 2016 12:39 pm

Re: Exporting live .csv file to use in Processing?

Post by kgil05 » Fri Apr 29, 2016 1:52 pm

Hi Klaus,

Thanks for getting back to me so fast!

Yes, it's to write the data as the user inputs it into the datagrid, and it's in the style of a form.

The data visualisation will be made in processing so I am wondering if there is a way I can take the inputed datagrid information and use it in Processing as it is being inputted.


thanks,

katy

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Exporting live .csv file to use in Processing?

Post by Klaus » Fri Apr 29, 2016 2:13 pm

Hi Katy,

the "content" of a datagrid is an ARRAY in form:
...
array[1]["name of column 1"]
array[1]["name of column 2"]
...
array[1]["name of column N"]
...
array[N]["name of column 1"]
array[N]["name of column 2"]
...
array[N]["name of column N"]
...
You get the picture, and you can access it at any time with:
...
put the dgData of grp "your datagrid group here" into tArrayVariable
## Now process tArrayVariable as desired...
...
Is that what you are looking for?


Best

Klaus

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

Re: Exporting live .csv file to use in Processing?

Post by dunbarx » Fri Apr 29, 2016 3:36 pm

Hi.

Klaus has shown you how to use the DG array directly.

Know also that there is a conversion for that data into ordinary form, using the "dgText"

Code: Select all

put the dgText of group "yourDG" into tData
I find, especially when debugging, this is easier to use, and far more native LC functionality can operate on standard data as opposed to array data.

Craig Newman

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Exporting live .csv file to use in Processing?

Post by Klaus » Fri Apr 29, 2016 4:03 pm

Yes, sure, but that will break as soon as you have multi-line fields in the datagrid.
That's why I asked what type of datagrid this is.

Post Reply