Loading ...
Sorry, an error occurred while loading the content.

17672Re: Newbie seeks help with array processing

Expand Messages
  • dracorat
    Mar 28, 2008
      Here is a program I wrote that takes apart a string and then creates
      an XML document based on the results.

      I hope it has the info you need. If not, ask for more.

      The source data looks like this btw:
      36094 PERSON NAME 3515 PENNYROYAL LN 80906 $93,147.86 Withdrawn
      36630 ANOTHER NAME 1103 N CHELTON RD 80909 $93,460.75 Withdrawn
      37654 AND YET ANOTHER 537 HOLLY DR 80911 $88,991.70 Redeemed by Owner

      Now, the clip:
      ^!SET %DocIndex%=^$GetDocIndex$
      ^!SET %FileCheck%=^$GetFiles("c:\";Transactional.XML)$
      ^!SetWordWrap OFF
      ^!If "^%FileCheck%" > "" NEXT ELSE CreateFile
      ^!Open "C:\Transactional.XML" /J=-1
      ^!SetWordWrap OFF
      ^!Goto BeginWork
      ^!TOOLBAR New Document
      ^!SetWordWrap OFF
      ^!Save AS "C:\Transactional.XML"

      ^!SetDocIndex ^%DocIndex%
      ^!Jump DOC_START
      ^!Set %TotalLines%=^$GetLineCount$
      ^!Set %CurrentLine%=0

      ^!Select LINE
      ^!SetArray %Data%=^$GetReSubStrings$
      ^!IF ^%Data0% < 6 BADROW
      ^!SET %Data1%=^$StrReplace("&";"&";^%Data1%;False;False)$
      ^!SET %Data2%=^$StrReplace("&";"&";^%Data2%;False;False)$
      ^!SET %Data3%=^$StrReplace("&";"&";^%Data3%;False;False)$
      ^!SET %Data4%=^$StrReplace("&";"&";^%Data4%;False;False)$
      ^!SET %Data5%=^$StrReplace("&";"&";^%Data5%;False;False)$
      ^!SET %Data6%=^$StrReplace("&";"&";^%Data6%;False;False)$
      ^!Open "C:\Transactional.XML" /J=-1
      ^!Save AS "C:\Transactional.XML"
      ^!Goto PostProcessing

      ^!Prompt "The Highlighted Row Could Not Be Processed"

      ^!SetDocIndex ^%DocIndex%
      ^!Set %CurrentLine%="^$Calc(^%CurrentLine%+1)$"
      ^!If ^%CurrentLine%=^%TotalLines% FinishOut
      ^!Select 0
      ^!Jump +1
      ^!Goto WorkLoop

      ^!Select 0
      ^!Jump DOC_END
      ^!Open "C:\Transactional.XML" /J=-1

      Inside the WorkLoop has most of what you're asking for I believe but
      the whole program is included so you can test with it.



      --- In ntb-clips@yahoogroups.com, Ed Wilson <eddwilson@...> wrote:
      > Can anyone point me to resources/advice on use of arrays in NoteTab?
      And then string concatenation? Ed
    • Show all 9 messages in this topic