Need a sanity check. Using `File.getReader().readU...
# suitescript
d
Need a sanity check. Using
File.getReader().readUntil(',')
doesn't work unless I also call
File.getContents()
??!? Even if I'm doing nothing with the contents, just logging it:
question answered 1
the file.File object "csvFile" is from
file.create(…)
getting the file.File object via
file.load(…)
and getting the reader from that means that you don't have to call
File.getContents()
My theory is that even though
file.create(…)
says that it returns a file.File object, it's not quite a fully-fledged file.File object until you call
.getContents()
on it
Yeah, I think that's correct, as calling
.save()
on the file first (instead of
.getContents()
) also works
This was in SS2.1, but I've just confirmed that SS2.0 has the issue also. Logging a ticket with NS support
g
if that’s how it behaves i’m fine with that. seems normal to want a lean
file
record/stub without the contents of the file much of the time. if you’re arguing that
getReader()
should do this automatically, then you’re really only saving yourself some typing but file contents can change without
file
stub changing so maybe it’s actually what you want?
d
Yeah, that makes sense. I was mostly railing against the lack of documentation about it.
file.create()
returns a file.File object, which by all accounts you should be able to use
getReader()
on. I can't get the time back I spent debugging, but would settle for the docs of
getReader()
getting amended to mention this