User bio
404 bio not found
Member since Jul 22, 2016
Replies:

I had a similar requirement, so created a simple method to achieve this. May be someone else is also looking for something similar

ClassMethod CreateCSVArray(
	csvrec = "",
	Output csvarray)
{
	s csvarray=0
	i csvrec'=""{
		s csvlen=$l(csvrec)
		i csvlen>1{
			s token=""
			f i=1:1:csvlen{
				s char=$we(csvrec,i)
				i char=""""{
					s closequotepos=$find(csvrec,"""",i+1)
					s csvarray($i(csvarray))=$we(csvrec,i+1,closequotepos-2)
					s i=closequotepos
					s token=""
				}else{
					i char'=","{
						s token=token_char
					}else{
						s csvarray($i(csvarray))=token
						s token=""
					}
				}
			}
			s:token'="" csvarray($i(csvarray))=token
		}
	}
}

Which produced the output:

myarr=5
myarr(1)="ABC Company"
myarr(2)="123 Main St, Ste 102"
myarr(3)="Anytown, DC"
myarr(4)=10001
myarr(5)="234-567-8901"

Certifications & Credly badges:
Global Masters badges:
Tony has no Global Masters badges yet.
Followers:
Following:
Tony has not followed anybody yet.