0

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

null
    • Choices_Software_Dean
    • 3 yrs ago
    • Reported - view

    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.

    • Peter_Romao
    • 3 yrs ago
    • Reported - view

    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.

    • Peter_Romao
    • 3 yrs ago
    • Reported - view

    Actually what I would like to achieve is to get a full XML file into ninox. Work on it. And save it out again.

    • Choices_Software_Dean
    • 3 yrs ago
    • Reported - view

    While viewing table, select "Import" or "Export" from the Tools pop-up at the upper left corner of the table.

    • Peter_Romao
    • 3 yrs ago
    • Reported - view

    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.

    • Sean
    • 3 yrs ago
    • Reported - view

    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.

    • Peter_Romao
    • 3 yrs ago
    • Reported - view

    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!

    • Sean
    • 3 yrs ago
    • Reported - view

    You haven't said where the text file to import is located. You might want to check out this thread...

     

    https://ninox.com/en/forum/ideas-and-suggestions-5abb9f4f45eda7ea1e75ed02/openfile-less-greater-openurl-5e4d2fad5cf8ef750dd1ebbf

    • Sean
    • 3 yrs ago
    • Reported - view

    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?

    • Peter_Romao
    • 3 yrs ago
    • Reported - view

    Hmmm,

    thanks Sean,

    that could work. How did you do that, may i ask? 

    • Sean
    • 3 yrs ago
    • Reported - view

    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

  • 3 yrs agoLast active
  • 11Replies
  • 2264Views