Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Igor-Ribeiro-Nordica
Contributor
Contributor

Convert Fact Table from XML and TXT

I received two files to represent a fact table. One is a .xml file and other is a .txt. How can I use these two files to create a comprehensive normal format fact table in Qlik SaaS?

XML:

<?xml version="1.0" encoding="UTF-8"?>
    <FlatFileDefinition TemplateName="MDTRM: Fcc, OutletCode - SIN Reporte" FileName="FFFC_BRA_SMPMDTRM_150A_202206.txt" ZipName="">
      <Columns>
        <Column Name="Outlet_Code" Start="1" Length="10" Repeat="1" Type="Field" />
        <Column Name="Regi_Cod" Start="11" Length="3" Repeat="1" Type="Field" />
        <Column Name="Dist_Cod" Start="14" Length="4" Repeat="1" Type="Field" />
        <Column Name="Terr_Cod" Start="18" Length="6" Repeat="1" Type="Field" />
        <Column Name="Clie_Let" Start="24" Length="1" Repeat="1" Type="Field" />
        <Column Name="Fcc" Start="25" Length="10" Repeat="1" Type="Field" />
        <Column Name="Units_PeriodNumber" Start="35" Length="15" Repeat="24" Type="Measure" />
        <Column Name="Values_PeriodNumber" Start="395" Length="15" Repeat="24" Type="Measure" />
        <Column Name="WholeSaler_Code" Start="755" Length="10" Repeat="1" Type="Field" />
        <Column Name="SumControl_Units_PeriodNumber" Start="765" Length="25" Repeat="1" Type="MeasureControl" />
        <Column Name="SumControl_Values_PeriodNumber" Start="790" Length="25" Repeat="1" Type="MeasureControl" />
      </Columns>
    </FlatFileDefinition>

 TXT (first 2 lines):

00002810900010010000001A0000050790000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000002.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000077.4900000081900000000000000000000002.000000000000000000000077.49
00003967640010010000001A0000050790000000000000.00000000000000.00000000000000.00000000000002.00000000000000.00000000000000.00000000000000.00000000000002.00000000000000.00000000000000.00000000000002.00000000000000.00000000000000.00000000000000.00000000000000.00000000000002.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000090.55000000000000.00000000000000.00000000000000.00000000000081.13000000000000.00000000000000.00000000000085.83000000000000.00000000000000.00000000000000.00000000000000.00000000000072.59000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.00000000000000.0000000021870000000000000000000008.000000000000000000000330.10

Labels (2)
1 Solution

Accepted Solutions
Igor-Ribeiro-Nordica
Contributor
Contributor
Author

Eventually I managed to solve this, so for anyone who finds the same issue:

The xml file gives the coordinates to extract data from the txt file using the "MID(start, length)" function. Where it says "Repeat" is just reapeating the function over and over again for x repeats.

 

View solution in original post

1 Reply
Igor-Ribeiro-Nordica
Contributor
Contributor
Author

Eventually I managed to solve this, so for anyone who finds the same issue:

The xml file gives the coordinates to extract data from the txt file using the "MID(start, length)" function. Where it says "Repeat" is just reapeating the function over and over again for x repeats.