kdjonesmtb2
Technical User
Hello
I am not seeing the array value in my print display with the following code
The print displays only the print headers
dim sComment
dim aLine
dim sLine
dim aField
sComment="1:CPT:97140:1" & char(13)& char(10) & _
"2:CPT:97110:1" & char(13)& char(10) & _
"3:CPT:97035:1" & char(13)& char(10) & _
"4:CPT:97033:1" & char(13)& char(10) & _
"5:CPT:97010:1" & char(13)& char(10) & _
"6:CPT:97014:1" & char(13)& char(10) & _
"7:CPT:97001:1"
'note: sometimes linefeeds are used without carriage returns, the following straightens this out
'usually you should see carriage return followed by a line feed - but sometimes you'll find
'just a line feed or a carriage return all by itself
'we fix this by replacing line feeds with carriage returns and then replacing
'all double carriage returns with single carriage returns
sComment = replace(sComment,char(10),char(13)) 'replace line feeds with carriage returns
sComment = replace(sComment,char(13)& char(13),char(13)) 'replace double returns with single
aLine=split(sComment,char(13))
'dim iRow, aTarget (len(aLine), 4) 'creates an array to store the rows with the needed fields
dim iRow, aTarget(1, 4) 'creates an array to store the rows with the needed fields
Redim aTarget(len(aLine),4) 're-dimension the array to the proper size
iRow=0
for each sLine in aLine
If len(sLine)>0 then
aField=split(sLine,":")
'note: you may want to test the length
'now add the values to a multi dimensional array.
iRow=iRow+1 'increment rows and add to the target array
aTarget(iRow,1)=aField(1)
aTarget(iRow,2)=aField(2)
aTarget(iRow,3)=aField(3)
aTarget(iRow,4)=aField(4)
print ("aField(1)")
print aField(1) 'should show "1" first time through
print ("aField(2)")
print aField(2) 'should show "CPT"
print ("aField(3)")
print aField(3) 'should show "97140" first time through
print ("aField(4)")
print aField(4) 'should show "1
I am not seeing the array value in my print display with the following code
The print displays only the print headers
dim sComment
dim aLine
dim sLine
dim aField
sComment="1:CPT:97140:1" & char(13)& char(10) & _
"2:CPT:97110:1" & char(13)& char(10) & _
"3:CPT:97035:1" & char(13)& char(10) & _
"4:CPT:97033:1" & char(13)& char(10) & _
"5:CPT:97010:1" & char(13)& char(10) & _
"6:CPT:97014:1" & char(13)& char(10) & _
"7:CPT:97001:1"
'note: sometimes linefeeds are used without carriage returns, the following straightens this out
'usually you should see carriage return followed by a line feed - but sometimes you'll find
'just a line feed or a carriage return all by itself
'we fix this by replacing line feeds with carriage returns and then replacing
'all double carriage returns with single carriage returns
sComment = replace(sComment,char(10),char(13)) 'replace line feeds with carriage returns
sComment = replace(sComment,char(13)& char(13),char(13)) 'replace double returns with single
aLine=split(sComment,char(13))
'dim iRow, aTarget (len(aLine), 4) 'creates an array to store the rows with the needed fields
dim iRow, aTarget(1, 4) 'creates an array to store the rows with the needed fields
Redim aTarget(len(aLine),4) 're-dimension the array to the proper size
iRow=0
for each sLine in aLine
If len(sLine)>0 then
aField=split(sLine,":")
'note: you may want to test the length
'now add the values to a multi dimensional array.
iRow=iRow+1 'increment rows and add to the target array
aTarget(iRow,1)=aField(1)
aTarget(iRow,2)=aField(2)
aTarget(iRow,3)=aField(3)
aTarget(iRow,4)=aField(4)
print ("aField(1)")
print aField(1) 'should show "1" first time through
print ("aField(2)")
print aField(2) 'should show "CPT"
print ("aField(3)")
print aField(3) 'should show "97140" first time through
print ("aField(4)")
print aField(4) 'should show "1