<?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>topic Re: Add sales ranges to sales order table in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Add-sales-ranges-to-sales-order-table/m-p/2080039#M88595</link>
    <description>&lt;P&gt;Hi there,&lt;/P&gt;
&lt;P&gt;I might have found the solution myself.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;I changed the [Orders]&amp;nbsp; table to [OrdersTemp];&lt;/LI&gt;
&lt;LI&gt;I added the following mapping load table:&lt;BR /&gt;&lt;BR /&gt;
&lt;P&gt;[OrderSizeFromMapping]:&lt;BR /&gt;Mapping Load Distinct [Value],&lt;BR /&gt;[OrderSizeFrom]&lt;BR /&gt;Resident [BridgeTableOrderSize];&lt;BR /&gt;&lt;BR /&gt;With this table I'm mapping the [OrderSizeFrom] value to the [Value] from the [Orders] by loading it from the [BridgeTableOrderSize];&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;I added another mapping load table:&lt;BR /&gt;&lt;BR /&gt;[OrderSizeCodeMapping]:&lt;BR /&gt;Mapping Load [OrderSizeFrom],&lt;BR /&gt;[OrderSizeCode]&lt;BR /&gt;Resident [OrderSize];&lt;BR /&gt;&lt;BR /&gt;With this table I'm mapping the [OrderSizeFrom] to the [OrderSizeCode] from the [OrderSize] table;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;I load the [Orders] table from the [OrdersTemp] table with the following load script:&lt;BR /&gt;&lt;BR /&gt;[Orders]:&lt;BR /&gt;Load *,&lt;BR /&gt;ApplyMap('OrderSizeCodeMapping', ApplyMap('OrderSizeFromMapping', [Value]), Null()) as [OrderSizeCode]&lt;BR /&gt;Resident [OrdersTemp];&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;And finally I'm dropping the&amp;nbsp;[BridgeTableOrderSize] and the [OrdersTemp] table:&lt;BR /&gt;&lt;BR /&gt;Drop Tables [OrdersTemp], [BridgeTableOrderSize];&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;This combined results in the following data model:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SBN_0-1685960677976.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/109209iD4C13A513757852F/image-size/large?v=v2&amp;amp;px=999" role="button" title="SBN_0-1685960677976.png" alt="SBN_0-1685960677976.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I attached the final simplified version for future reference.&lt;/P&gt;
&lt;P&gt;Is this the way to solve this or is there a better, more efficient way?&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;
&lt;P&gt;SBN&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Jun 2023 10:26:10 GMT</pubDate>
    <dc:creator>SBN</dc:creator>
    <dc:date>2023-06-05T10:26:10Z</dc:date>
    <item>
      <title>Add sales ranges to sales order table</title>
      <link>https://community.qlik.com/t5/App-Development/Add-sales-ranges-to-sales-order-table/m-p/2080019#M88589</link>
      <description>&lt;P&gt;Hi there fellow Qlik enthousiasts,&lt;/P&gt;
&lt;P&gt;I have the following two tables in my simplified example.&lt;/P&gt;
&lt;P&gt;[Orders]:&lt;BR /&gt;Load * Inline [&lt;BR /&gt;Order,Date,CustomerID,SalespersonID,Value&lt;BR /&gt;1,1-5-2023,1,1,100&lt;BR /&gt;2,1-5-2023,2,2,350&lt;BR /&gt;3,2-5-2023,1,2,1500&lt;BR /&gt;4,2-5-2023,2,2,10020&lt;BR /&gt;5,3-5-2023,1,1,221000&lt;BR /&gt;6,4-5-2023,2,1,27500&lt;BR /&gt;7,2-5-2023,2,3,750000&lt;BR /&gt;8,4-5-2023,1,3,85000&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;[OrderSize]:&lt;BR /&gt;Load * Inline [&lt;BR /&gt;OrderSizeCode, OrderSizeFrom, OrderSizeTo, OrderSizeDescription&lt;BR /&gt;01,0,250,01. € 0 up and to € 250&lt;BR /&gt;02,251,500,02. € 251 up and to € 500&lt;BR /&gt;03,501,1000,03. € 501 up and to € 1.000&lt;BR /&gt;04,1001,2000,04. € 1.001 up and to € 2.000&lt;BR /&gt;05,2001,5000,05. € 2.001 up and to € 5.000&lt;BR /&gt;06,5001,10000,06. € 5.001 up and to € 10.000&lt;BR /&gt;07,10001,25000,07. € 10.001 up and to € 25.000&lt;BR /&gt;08,25001,50000,08. € 25.001 up and to € 50.000&lt;BR /&gt;09,50001,75000,09. € 50.001 up and to € 75.000&lt;BR /&gt;10,75001,150000,10. € 75.001 up and to € 150.000&lt;BR /&gt;11,150001,250000,11. € 150.001 up and to € 250.000&lt;BR /&gt;12,250001,500000,12. € 250.001 up and to € 500.000&lt;BR /&gt;13,500001,100000000,13. from € 500.001&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;I have figured out that I can use the "IntervalMatch" function to create a "bridge" table where I can match the [Value]&amp;nbsp; from the [Orders] table with the [OrderSizeFrom] and [OrderSizeTo] from the [OrderSize] table.&lt;/P&gt;
&lt;P&gt;[BridgeTableOrderSize]:&lt;BR /&gt;IntervalMatch ([Value])&lt;BR /&gt;LOAD distinct [OrderSizeFrom], [OrderSizeTo]&lt;BR /&gt;Resident [OrderSize];&lt;/P&gt;
&lt;P&gt;If I'm not mistaken this use the field [Value]&amp;nbsp; as the key.&lt;/P&gt;
&lt;P&gt;In my more complex data model I also have a table with [Opportunities] and [Quotations] where I'd like to apply the [OrderSize] table as well.&lt;BR /&gt;The [OrderSize] table would be loaded from an Excel file so the customer will be able to set there own sizes.&lt;BR /&gt;Preferably without using additional IntervalMatch tables&lt;/P&gt;
&lt;P&gt;If it's possible I would like to end up with the following [Orders] table with an additional column with the "OrderSizeCode" from the [OrderSize] table.&lt;/P&gt;
&lt;P&gt;[Orders]:&lt;BR /&gt;Load * Inline [&lt;BR /&gt;Order,Date,CustomerID,SalespersonID,Value,OrderSizeCode&lt;BR /&gt;1,1-5-2023,1,1,100,01&lt;BR /&gt;2,1-5-2023,2,2,350,02&lt;BR /&gt;3,2-5-2023,1,2,1500,04&lt;BR /&gt;4,2-5-2023,2,2,10020,07&lt;BR /&gt;5,3-5-2023,1,1,221000,11&lt;BR /&gt;6,4-5-2023,2,1,27500,08&lt;BR /&gt;7,2-5-2023,2,3,750000,13&lt;BR /&gt;8,4-5-2023,1,3,85000,10&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;Is this possible?&lt;/P&gt;
&lt;P&gt;I attached an example QVF to play with...&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;BR /&gt;Thanks in advance for your suggestions.&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;
&lt;P&gt;SBN&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2023 09:53:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Add-sales-ranges-to-sales-order-table/m-p/2080019#M88589</guid>
      <dc:creator>SBN</dc:creator>
      <dc:date>2023-06-05T09:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: Add sales ranges to sales order table</title>
      <link>https://community.qlik.com/t5/App-Development/Add-sales-ranges-to-sales-order-table/m-p/2080039#M88595</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;
&lt;P&gt;I might have found the solution myself.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;I changed the [Orders]&amp;nbsp; table to [OrdersTemp];&lt;/LI&gt;
&lt;LI&gt;I added the following mapping load table:&lt;BR /&gt;&lt;BR /&gt;
&lt;P&gt;[OrderSizeFromMapping]:&lt;BR /&gt;Mapping Load Distinct [Value],&lt;BR /&gt;[OrderSizeFrom]&lt;BR /&gt;Resident [BridgeTableOrderSize];&lt;BR /&gt;&lt;BR /&gt;With this table I'm mapping the [OrderSizeFrom] value to the [Value] from the [Orders] by loading it from the [BridgeTableOrderSize];&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;I added another mapping load table:&lt;BR /&gt;&lt;BR /&gt;[OrderSizeCodeMapping]:&lt;BR /&gt;Mapping Load [OrderSizeFrom],&lt;BR /&gt;[OrderSizeCode]&lt;BR /&gt;Resident [OrderSize];&lt;BR /&gt;&lt;BR /&gt;With this table I'm mapping the [OrderSizeFrom] to the [OrderSizeCode] from the [OrderSize] table;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;I load the [Orders] table from the [OrdersTemp] table with the following load script:&lt;BR /&gt;&lt;BR /&gt;[Orders]:&lt;BR /&gt;Load *,&lt;BR /&gt;ApplyMap('OrderSizeCodeMapping', ApplyMap('OrderSizeFromMapping', [Value]), Null()) as [OrderSizeCode]&lt;BR /&gt;Resident [OrdersTemp];&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;And finally I'm dropping the&amp;nbsp;[BridgeTableOrderSize] and the [OrdersTemp] table:&lt;BR /&gt;&lt;BR /&gt;Drop Tables [OrdersTemp], [BridgeTableOrderSize];&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;This combined results in the following data model:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SBN_0-1685960677976.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/109209iD4C13A513757852F/image-size/large?v=v2&amp;amp;px=999" role="button" title="SBN_0-1685960677976.png" alt="SBN_0-1685960677976.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I attached the final simplified version for future reference.&lt;/P&gt;
&lt;P&gt;Is this the way to solve this or is there a better, more efficient way?&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;
&lt;P&gt;SBN&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2023 10:26:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Add-sales-ranges-to-sales-order-table/m-p/2080039#M88595</guid>
      <dc:creator>SBN</dc:creator>
      <dc:date>2023-06-05T10:26:10Z</dc:date>
    </item>
  </channel>
</rss>

