Either store the old value of Memowidth and change it in the beginning of the function, and reset it in the end of the function.
m.lcSubList = TableName.MemoFieldName
m.lnMemo = set('memowidth')
set memowidth to 1000
for m.i = 1 to MEMLINES(lcSubList )
m.lcItem = MLINE(lcSubList, i)
m.lnFirstColon = AT(":", lcItem)
m.lnSecondColon = AT(":", lcItem, 2)
m.lcNoteType = SUBSTR(lcItem, 1, (lnFirstColon-1))
m.lcPartNumber = STREXTRACT(lcItem,":",":")
m.ldIDate = IIF(lnSecondColon=0, DATE(), CTOD(SUBSTR(lcItem, lnSecondColon + 1)))
next
set memowidth to (m.lnMemo)
Or do as Peter suggests.
>I am parsing data stored in a memo field using mline(). I scan through the memo field in a for next loop.
>Example:
>Data stored looks like this:
>Re-Order Note:Make sure these are not the solder on type!!:09/30/2012
>Alternate:2610321608:8/30/2011
>
>m.lcSubList = TableName.MemoFieldName
>
>for m.i = 1 to MEMLINES(lcSubList ) && returns 3 if set memowidth is not in the datasession init
> m.lcItem = MLINE(lcSubList, i)
> m.lnFirstColon = AT(":", lcItem)
> m.lnSecondColon = AT(":", lcItem, 2)
> m.lcNoteType = SUBSTR(lcItem, 1, (lnFirstColon-1))
> m.lcPartNumber = STREXTRACT(lcItem,":",":")
> m.ldIDate = IIF(lnSecondColon=0, DATE(), CTOD(SUBSTR(lcItem, lnSecondColon + 1)))
>next
>
>I then use the lcNoteType, lcPartNumber and the ldIDate in the form.
>
>The functions above depend on the memowidth setting. If I place the set memowidth setting in the form somewhere (load), this function does no work correctly. Moving the set memowidth statement to the init of the data session, it works as expected.
>
>The help says the default setting for memowidth is 50. Line one of the example is 69 characters in length.
>
>Is this proper?
>
>Thank you in advance,
>
>Gary De Lecce