Hi All,
I can import a text file and load its content into an array or Datagrid. Yay me.
BUT... How do I isolate the file name and display it in a label field?
So, if the text file was called "my text file" (they're being saved without the ".txt" extension and I really don't see a need to change that), I would want to have "my text file" displayed in a label just above the datagrid that holds all of the file's contents.
All help appreciated!
Isolating and displaying imported file names
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Isolating and displaying imported file names
Alternatively:
Is it possible to put information in the text field before the main array content and filter it off on retrieval?
For example, if my text file was a collection of a student's subjects and grades, could it be saved as:
Name: Random Student
Class: 10QC
Subject [tab] Mock Grade [tab] Challenge Grade [return]
Biology [tab] B [tab] A* [return]
...etc
So... I'd want to take the first two lines and display them on the card above the datagrid which will contain the main information below.
Any thoughts?
Thanks again
Is it possible to put information in the text field before the main array content and filter it off on retrieval?
For example, if my text file was a collection of a student's subjects and grades, could it be saved as:
Name: Random Student
Class: 10QC
Subject [tab] Mock Grade [tab] Challenge Grade [return]
Biology [tab] B [tab] A* [return]
...etc
So... I'd want to take the first two lines and display them on the card above the datagrid which will contain the main information below.
Any thoughts?
Thanks again
Re: Isolating and displaying imported file names
To display stuff on a card you should use a field. Then you can use code to put stuff into the field, for example:
Your second question, as far as I understand it, is about how to put the two first lines of text into one field, and the rest into another field (or a datagrid):
Code: Select all
set the itemDelimiter to tab
answer file ""
put it into myPath
put item -1 of myPath into field "filename"
Code: Select all
answer file ""
put url ("file:" & it) into myList
put line 1 to 2 of myList into field "header data"
put line 3 to -1 of myList into field "actual data"
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode