Editing the content of text files
Hello,
I have the following issue.
Is there a way to import a text file and transfer its content into a multiline field that I could later parse?
Then I'd like to know if the opposite is also possible. Ie. to export the contents of a multiline text field into a .txt file.
I already sifted through the manual and scripting references but to no avail.
Thanks
11 replies
-
The below two records can be imported or exported as csv directly from or to a Text (multiline) field:
Id,Text (multiline)
1,"abc
def
ghi"
2,"123
456
789"
Not sure if I fully understand your question. Hope this helps.
-
Hello Dean,
I might not have been fully clear on my intents.
How do you mean directly?
Can I put the csv file in an image field and have a trigger extract its content into a multiline field?
Is that it?
As for your example the only thing I see could be done is to use createTextFile function in the onclick trigger of a button.
Can't see the other way: getting the import part done.
Thanks.
-
Actually what I would like to achieve is to get a full XML file into ninox. Work on it. And save it out again.
-
While viewing table, select "Import" or "Export" from the Tools pop-up at the upper left corner of the table.
-
Alright now I get it.
Sorry, never thought you were referring to those, I already knew that it could be done there.
My objective is to have this done programatically. The users of the database have no business going into that part of the UI.
-
It really doesn't get much easier than copying and pasting the text into a Text (multiline) field. Like you said, you can use the createTextFile function to copy the contents of the Text (multiline) field to a text file that will be attached to the currently selected record.
-
I understand what you are saying about the simplicity of the copy/paste procedure. The thing is I did not want to have users messing with xml /kml file contents. I'd rather have the code do it for them. Hence the wish to have an uploaded file read into a field without any user intervention besides him uploading the file.
Not possible, huh?
Thanks for taking the time to answer!
-
You haven't said where the text file to import is located. You might want to check out this thread...
-
FWIW, I was able to copy text from a text file attached to a Ninox record to a Text field using the
http()
function. Is that what you had in mind? -
Hmmm,
thanks Sean,
that could work. How did you do that, may i ask?
-
Hi Peter, I put the following in a button...
let tId := this.Id;
let URL := "file:///Users/seansullivan/Library/Containers/de.ninoxdb.ninox-mac.Ninox/Data/Documents/data/HTMLTest/files/F/" + tId + "/Testing.txt";
let rt := html("");
let response := http("GET", URL);
if response.error then
rt := html("File not found")
else
rt := html(response.result)
end;
MultilineTextField := rt
Content aside
- 4 yrs agoLast active
- 11Replies
- 2285Views