Is it possible to return the contents of a txt fil...
# suitescript
n
Is it possible to return the contents of a txt file in the doc library via client script?
a
You can't load a file using a NS Api in the client side. However you can: • Publish the file and read it cliente side using an XHR • Store the content of the TXT file in "volatile" (custpage) fields that you create dynamically according to the file dimension (100K each for a long text)
The second approach is really good when you have a lot of client data interactions, like for cascading filters and you don't want the client to perform too much searches. In this case you prepare the data before load, server side (adding time to the page load) and you store the data structure in a temp (or set) field. Then you read the data from the field and you parse it in JSON / you use it for perform what you need without doing real time searches.
s
hmm, for the same use case above I would typically prefer to load the data using the
Promise
based search apis perhaps on pageInit() or some other just-in-time spot and store the data in a normal variable.