Question Smythe Smythee · Jun 12, 2024

How to read from a file

Hi Community ,

I have a csv file to read and validate the data in the file 

How can i ready only 1st line from the file using Readline()

Thanks,

smythee

Product version: IRIS 2022.1
$ZV: HealthShare Unified Care Record 2022.1.0 Build: 1006 [HealthShare Modules: Health Insight:23.0 + Core:23.0 + Patient Index:23.0] - IRIS for Windows (x86-64) 2021.1.2

Comments

Luis Angel Pérez Ramos · Jun 12, 2024

Just the first line?

set str=##class(%Stream.FileCharacter).%New()
do str.LinkToFile("c:\myfolder\file.csv")
set$listbuild(VALUE1,VALUE2,VALUE3)=$listfromstring(str.ReadLine())
0
Dan Pasco  Jun 17, 2024 to Luis Angel Pérez Ramos

And the first two lines can be combined:

set str = ##class(%Stream.FileCharacter).%OpenId("c:\myfolder\file.csv")

0