Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
SRP Clean Array
Do you have any idea why the free utility function, SRP_Clean_Array, would stop working? It was working fine, but suddenly doesn’t work. It will clean arrays like @FM:@FM:@FM:”Don”:@FM:”Bob”:@FM:@FM, but it will not clean arrays that typically come from EditTables like @VM:@VM:@VM:@FM:@VM:@VM:@VM:@FM:@VM:@VM:@VM. It’s got me stumped. I have used the following syntax:
NewArray = SRP_Clean_Array(ExistingArray)
OR
NewArray = SRP_Clean_Array(ExistingArray, @FM, "")
OR
NewArray = SRP_Clean_Array(ExistingArray, @FM, "UNIQUE")
None of those are cleaning the array of those lines that have @VM delimeters in it.
Any thoughts?
NewArray = SRP_Clean_Array(ExistingArray)
OR
NewArray = SRP_Clean_Array(ExistingArray, @FM, "")
OR
NewArray = SRP_Clean_Array(ExistingArray, @FM, "UNIQUE")
None of those are cleaning the array of those lines that have @VM delimeters in it.
Any thoughts?
Comments
I had code to do this manually, but performance was lacking, so with a bit of a think I have a solution in a procedure.
Given the assumption that every row has the same number of @VMs, count the first row and the swap these out.
This is based on ARRAY property, but if you are using the LIST property then it is even easier as the rotates are not needed.
Seems to work, but I have just added to my code and not tested fully.
Colin
TABLE=SRP_Rotate_Array(TABLE)
MVCount=COUNT(TABLE<1>,@VM)
String=STR(@VM,MVCount):@FM
SWAP String WITH "" IN TABLE
TABLE=SRP_Rotate_Array(TABLE)
utf8mode = isUTF8()
If
utf8mode
then
Call
SetUTF8(
0
) ;* system delimiter bytes will never be contained within OI UTF8 multi-
byte
characters!
pos = len( data)
curr.delim =
5
; data.delim =
6
Loop
while
pos
delim = index(
\FAFBFCFDFEFF\
, data[ pos,
1
],
1
)
If
delim
then
If
delim <= curr.delim
then
If
delim < data.delim
then
data[ pos,
1
] =
''
End
else
If
not( curr.delim)
or
delim > data.delim
then
data.delim = delim
curr.delim = delim
End
End
else
If
curr.delim
then
If
data[ pos,
1
] =
' '
then
data[ pos,
1
] =
''
end
else
curr.delim =
0
End
End
End
pos -=
1
Repeat
If
utf8mode
then
Call
SetUTF8( utf8Mode)
<code>
Cheers,
M@
</code>