Get Delimited String

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Jason Pate
    Forum Member
    • Jan 2002
    • 328

    Get Delimited String

    In SF6 had a great Action "Get Delimited String" would let you search out a specific item in a string. I know this function has been replaced by Tables, issue that I have is the string value is in a file, and when I load it into a table, it see's it as a single table entry pre line, so my Delimiter is useless. File is a HL7 Message I attached a sample file. I want to use AM5 to display some of the text items in a nice GUI. Any help would be appericated.

    How can I get the item loaded into a table so it see each "|" as a new record?
    Attached Files
  • Brett
    Indigo Rose Staff Member
    • Jan 2000
    • 2001

    #2
    Attached is a project that works with your file. The guts of it used the uber-powerful Lua standard library string.gsub function with a callback to a function on finds.

    Code:
    strRawData = TextFile.ReadToString("AutoPlay\\Docs\\1.dat");
    strOutput = "";
    
    -- Callback function for pattern matches
    function ValueFound(strText)
    	strText = String.TrimRight(strText,"|");
    	strOutput = strOutput..strText.."\r\n";
    end
    
    -- string.gsub is not an official AMS50 function, it is form
    -- the standard lua libraries
    string.gsub(strRawData,"(.-|)",ValueFound);
    
    -- Output
    Paragraph.SetText("Output",strOutput);
    Attached Files

    Comment

    • Jason Pate
      Forum Member
      • Jan 2002
      • 328

      #3
      Brett,

      Thank you, that is what I needed, I will read up on that Lua Function I am just going to add a table.incert and a count in the fuction and I am on my way thanks.

      Comment

      Working...
      X