How to get selected file in filelist into datagrid?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
How to get selected file in filelist into datagrid?
How can i get a selected file in a filelist into a datagrid?
Best regards Tue.
Best regards Tue.
Re: How to get selected file in filelist into datagrid?
Hi.
A dataGrid is a complex LC object, comprised of fields and behaviors. But at heart it accepts and displays tab and return delimited data.
So if your file is so formatted, all you need to do is to: It just goes in. From there, well, that is up to you. It requires patience and experience to manipulate and manage the contents and functionality of data grids, but that comes with time.
Craig Newman
A dataGrid is a complex LC object, comprised of fields and behaviors. But at heart it accepts and displays tab and return delimited data.
So if your file is so formatted, all you need to do is to:
Code: Select all
set the dgText of group "yourDG" to yourFileDataProperlyFormatted
Craig Newman
Re: How to get selected file in filelist into datagrid?
I have this filelist "Skabeloner" with files in, when I select a file, only that filename should appear in my datagrid field "Skabelon"?
Right now i'm using this bit of code:
and that puts all the filenames in the field "Skabelon" in my datagrid.
Right now i'm using this bit of code:
Code: Select all
put the field "FileList" into theDataA["Skabelon"]
Re: How to get selected file in filelist into datagrid?
Hi tusa,
1. welcome to the forum!
2. We need a bit more info from you!
Do you have a script in the field on the left side like:
?
And do you really only want to have the selected filename in the datagrid?
I thought you want the CONTENT of that file in the datagrid?
If yes, where are these files?
In the list field there are only the filenames and not the pathnames to these files.
And yes -> put fld "XYZ" into whatever
will put the complete content of field "XYZ" into a variable named "whatever"
Here some great learning resources for the basics of Livecode, which are essential!
http://www.hyperactivesw.com/revscriptc ... ences.html
Best
Klaus
1. welcome to the forum!

2. We need a bit more info from you!
Do you have a script in the field on the left side like:
Code: Select all
on mouseup
### put the field "FileList" into theDataA["Skabelon"]
### Do not use THE when addressing LC objects!
put field "FileList" into theDataA["Skabelon"]
set the dgdata of grp "your dg here" to theDataA
end mouseup
And do you really only want to have the selected filename in the datagrid?
I thought you want the CONTENT of that file in the datagrid?
If yes, where are these files?
In the list field there are only the filenames and not the pathnames to these files.
And yes -> put fld "XYZ" into whatever
will put the complete content of field "XYZ" into a variable named "whatever"
Here some great learning resources for the basics of Livecode, which are essential!
http://www.hyperactivesw.com/revscriptc ... ences.html
Best
Klaus
Re: How to get selected file in filelist into datagrid?
Hey Klaus.
I have a script, when I press a button.
I only need the filename as I select in the filelist.
And now I got it working:
put only the selected filename into the datagrid... YES!
How do then put the selected value from a combobox in my datagrid?
I have a script, when I press a button.
I only need the filename as I select in the filelist.
And now I got it working:
Code: Select all
put the selectedText of field "FileList" into theDataA["Skabelon"]
How do then put the selected value from a combobox in my datagrid?
Re: How to get selected file in filelist into datagrid?
Hi tusa,
You can of course use shorter variable names than "tSelectedMenuItem"
I just used this to show you what will be in that parameter!
And you need to replace XXXX in the script with what- and whereever you need
that value in your datagrid.
If you use -> theDataA["Skabelon"]
that will overwrite your complete datagrid.
Same if you use -> theDataA["Lag"]
Maybe preserve the current data in the datagrid and just ADD the "Lag" column:
This will only affect line 1 of your datagrid.
As you see, it starts to get a bit copmplicated, but that is the nature of datagrids unfortunately.
Check these pages and download the datagrid documantation as PDF from that page:
http://lessons.livecode.com/m/datagrid
Hint: the download link is hidden in tiny fontsize on the left side under "Topics".
Best
Klaus
Add this script to the combo-box:tusa wrote:...
How do then put the selected value from a combobox in my datagrid?
Code: Select all
on menupick tSelectedMenuItem
put tSelectedMenuItem into XXXX
end menuick
I just used this to show you what will be in that parameter!
And you need to replace XXXX in the script with what- and whereever you need
that value in your datagrid.
If you use -> theDataA["Skabelon"]
that will overwrite your complete datagrid.
Same if you use -> theDataA["Lag"]
Maybe preserve the current data in the datagrid and just ADD the "Lag" column:
Code: Select all
on menupick tSelectedMenuItem
put the dgdata of grp "your dg here" into theData
put tSelectedMenuItem into theData[1]["Lag"]
set the dgdata of grp "your dg here" to theData
end menuick
As you see, it starts to get a bit copmplicated, but that is the nature of datagrids unfortunately.

Check these pages and download the datagrid documantation as PDF from that page:
http://lessons.livecode.com/m/datagrid
Hint: the download link is hidden in tiny fontsize on the left side under "Topics".
Best
Klaus
Re: How to get selected file in filelist into datagrid?
Just what I needed, Now I can get both the selected text in the filelist into my datagrid and I can get my checkbox data...
Tank you.
Tank you.