<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: How can I dynamically parse flat file with nested values? in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/how-can-i-dynamically-parse-flat-file-with-nested-values/qaa-p/780725#M233558</link>
    <description>&lt;P&gt;Thanks,  &lt;SPAN class="mention-scrubbed"&gt;dirk.venken&lt;/SPAN&gt;. I used the loop idea and trimmed the string after each column was parsed. It worked a treat!&lt;/P&gt;</description>
    <pubDate>Thu, 31 Jan 2019 23:42:24 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2019-01-31T23:42:24Z</dc:date>
    <item>
      <title>How can I dynamically parse flat file with nested values?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-can-i-dynamically-parse-flat-file-with-nested-values/qaq-p/780723</link>
      <description>&lt;P&gt;I have a string I need to parse through and load into a table, but the string has multiple levels within it, and no delimiters. For example:&lt;/P&gt;
  &lt;P&gt;010203040519012717400607081901271740&lt;/P&gt;
  &lt;P&gt;01 is a device number&lt;BR /&gt;02 is the number of reports coming in the string that relate to that device number&lt;BR /&gt;03 is report data&lt;BR /&gt;04 is report data&lt;BR /&gt;05 is report data&lt;BR /&gt;1901271740 is the datetime the report was run&lt;/P&gt;
  &lt;P&gt;I had the series repeat to show the number of reports. Logically it would look like:&lt;/P&gt;
  &lt;P&gt;01 - Device Number 02 - Number of Reports&lt;BR /&gt;First report (03, 04, 05, datetime)&lt;BR /&gt;Second report (06, 07, 08, datetime)&lt;/P&gt;
  &lt;P&gt;The end result in the table I'd like would be&lt;/P&gt;
  &lt;P&gt;Device Number Report Data1 Report Data2 Report Data3&lt;BR /&gt;01 03 04 05&lt;BR /&gt;01 06 07 08&lt;/P&gt;
  &lt;P&gt;The series that contains the number of reports is 44 characters long, then the reports are 40 characters. This repeats, going over 1000 characters. I thought one way to do this would be to create a loop catching the device number and number of reports, setting the number of reports as a counter, then getting the next 40 characters for the number of times in the counter, then repeating this until reaching the end of the string. Would that solution work? Is there a better way?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jan 2019 01:14:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-can-i-dynamically-parse-flat-file-with-nested-values/qaq-p/780723</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-01-28T01:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: How can I dynamically parse flat file with nested values?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-can-i-dynamically-parse-flat-file-with-nested-values/qaa-p/780724#M233557</link>
      <description>&lt;P&gt;i would build a custom function that inserts xml-tags into the string. The result could look similar to this:&lt;BR /&gt;&amp;lt;dn&amp;gt;01&amp;lt;/dn&amp;gt;&amp;lt;nrep&amp;gt;02&amp;lt;/nrep&amp;gt;&amp;lt;rd&amp;gt;&amp;lt;rep&amp;gt;03 04 05&amp;lt;/rep&amp;gt;&amp;lt;dt&amp;gt;1901271740&amp;lt;/dt&amp;gt;&amp;lt;/rd&amp;gt;&amp;lt;rd&amp;gt;&amp;lt;rep&amp;gt;06 07 08&amp;lt;/rep&amp;gt;&amp;lt;dt&amp;gt;1901271740&amp;lt;/dt&amp;gt;&amp;lt;/rd&amp;gt;&lt;BR /&gt;This can be achieved this by counting characters in the input string, as you indicate. Check &lt;A href="https://wiki.scn.sap.com/wiki/display/EIM/How+to+split+a+comma+separated+String+into+multiple+rows+via+XML+strings"&gt;https://wiki.scn.sap.com/wiki/display/EIM/How+to+split+a+comma+separated+String+into+multiple+rows+via+XML+strings&lt;/A&gt; for a somewhat similar use case.&lt;BR /&gt;Map the input to this format in a first Query transform.&lt;BR /&gt;Create an .xsd file for the XML format. Import it into DS.&lt;BR /&gt;Call the extract_from_xml built-in function in a second Query transform, with the xsd name as second parameter.&lt;BR /&gt;Unnest the result in a third Query transform. Get rid of unnecessary data and write to a target table.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jan 2019 22:14:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-can-i-dynamically-parse-flat-file-with-nested-values/qaa-p/780724#M233557</guid>
      <dc:creator>former_member187605</dc:creator>
      <dc:date>2019-01-28T22:14:52Z</dc:date>
    </item>
    <item>
      <title>Re: How can I dynamically parse flat file with nested values?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-can-i-dynamically-parse-flat-file-with-nested-values/qaa-p/780725#M233558</link>
      <description>&lt;P&gt;Thanks,  &lt;SPAN class="mention-scrubbed"&gt;dirk.venken&lt;/SPAN&gt;. I used the loop idea and trimmed the string after each column was parsed. It worked a treat!&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 23:42:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-can-i-dynamically-parse-flat-file-with-nested-values/qaa-p/780725#M233558</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-01-31T23:42:24Z</dc:date>
    </item>
  </channel>
</rss>

