<?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: Iterative Calculation during Load in Qlik in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Iterative-Calculation-during-Load-in-Qlik/m-p/1515105#M36713</link>
    <description>&lt;P&gt;To turn columns into rows you will want to use the CrossTable load prefix. Read up on CrossTable in the&lt;A href="https://help.qlik.com/" target="_blank"&gt; help:&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;</description>
    <pubDate>Fri, 30 Nov 2018 21:47:57 GMT</pubDate>
    <dc:creator>rwunderlich</dc:creator>
    <dc:date>2018-11-30T21:47:57Z</dc:date>
    <item>
      <title>Iterative Calculation during Load in Qlik</title>
      <link>https://community.qlik.com/t5/App-Development/Iterative-Calculation-during-Load-in-Qlik/m-p/1515100#M36712</link>
      <description>&lt;P&gt;Pulling some data that has 4 columns that I want to turn into 4 rows.&amp;nbsp; I started by using an iterative loop where i = 1 to 4.&amp;nbsp; However I want to use the $(i) within a formula&amp;nbsp;&lt;SPAN&gt;to calculate the weighting of each base prem 1-4 to the total.&amp;nbsp; As soon as I insert this into the SQL I get an error - my script log is attached.&amp;nbsp; Any help would be greatly appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;(a.BASE_PREM$(i)/(a.BASE_PREM1+a.BASE_PREM2+a.BASE_PREM3+a.BASE_PREM4))*a.TOT_TRM_PRM as VEH_TRM_PRM&lt;/P&gt;&lt;P&gt;Here's my working script before adding the formula.&lt;/P&gt;&lt;P&gt;LIB CONNECT TO 'PRS_Auto_Inforce_AIP';&lt;/P&gt;&lt;P&gt;for i = 1 to 4&lt;/P&gt;&lt;P&gt;CAAS:&lt;BR /&gt;load&lt;BR /&gt;*&lt;BR /&gt;where len(trim(MODEL_YEAR))&amp;gt;0&lt;BR /&gt;;&lt;BR /&gt;Select&lt;BR /&gt;cast(replicate('0',12-len(ltrim(rtrim(a.POLICY_NO))))+ltrim(rtrim(a.POLICY_NO)) as varchar(99)) as POLICY_NUMBER&lt;BR /&gt;, replicate('0',7-len(a.AGENT_NO))+a.AGENT_NO as PROD_N&lt;BR /&gt;, a.SUB_AGENT as SUB_PROD_N&lt;BR /&gt;, a.COMPANY_CODE&lt;BR /&gt;, DATEADD(YEAR, -1,a.EXPRN_DATE) as EFFECTIVE_DATE&lt;BR /&gt;, a.EXPRN_DATE as EXPIRATION_DATE&lt;BR /&gt;, left(a.AS_OF_YYYYMMDD,6) as AS_OF_YYYYMM&lt;BR /&gt;, a.NO_OF_CARS as NUMBER_OF_VEHICLES&lt;BR /&gt;, a.NO_OF_DRVRS as NUMBER_OF_DRIVERS&lt;BR /&gt;, a.SCR_SCORE as INSURANCE_SCORE&lt;BR /&gt;, a.NAME_INSD1 as INSURED_NAME&lt;BR /&gt;, a.INSD_STREET as MAILING_ADDRESS&lt;BR /&gt;, a.INSD_CITY as MAILING_CITY&lt;BR /&gt;, a.INSD_STATE as MAILING_STATE&lt;BR /&gt;, a.INSD_ZIP as MAILING_ZIPCODE&lt;BR /&gt;, $(i) as UNIT_ID&lt;BR /&gt;, a.MODEL_YR$(i) as MODEL_YEAR&lt;BR /&gt;, case&lt;BR /&gt;when isnull(a.MODEL_YR$(i),0)=0 then 'UNKNOWN'&lt;BR /&gt;when a.MODEL_YR$(i)&amp;gt;=2010 then '2010+'&lt;BR /&gt;when a.MODEL_YR$(i)&amp;gt;=1990 then '1990-2010'&lt;BR /&gt;when a.MODEL_YR$(i)&amp;lt;1990 then '&amp;lt;1990'&lt;BR /&gt;end as MODEL_YEAR_GROUP&lt;BR /&gt;, a.AUTO_TYPE$(i) as VEHICLE_TYPE&lt;BR /&gt;, a.USE_CODE$(i) as VEHICLE_USE&lt;BR /&gt;, a.RATE_SYM_COMP_ISO$(i) as COMP_SYMBOL&lt;BR /&gt;, a.RATE_SYM_COLL_ISO$(i) as COLLISION_SYMBOL&lt;BR /&gt;, case when a.GAR_STATE_$(i) is null then a.INSD_CNTY else a.STATE_CODE end as GARAGE_STATE&lt;BR /&gt;, case when a.GAR_ZIP_$(i) is null then a.ZIP_CODE else a.GAR_ZIP_$(i) end as GARAGE_ZIPCODE&lt;BR /&gt;, case when a.GAR_COUNTY_$(i) is null then a.INSD_CNTY else a.GAR_COUNTY_$(i) end as GARAGE_COUNTY&lt;BR /&gt;, case when a.GAR_CITY_$(i) is null then a.INSD_CITY else a.GAR_CITY_$(i) end as GARAGE_CITY&lt;BR /&gt;, a.CAR_TERR$(i) as TERRITORY&lt;BR /&gt;, a.COLL_DED$(i) as COLLISION_DEDUCTIBLE&lt;BR /&gt;, a.COMP_DED$(i) as COMP_DEDUCTIBLE&lt;BR /&gt;, a.PASS_RES_$(i) as PASSIVE_RESTRAINT&lt;BR /&gt;, a.SER_NUM_$(i) as VIN_NUMBER&lt;BR /&gt;, a.AGREED_VAL$(i) as AGREED_VALUE&lt;BR /&gt;, 'Chubb' as LEGACY_COMPANY&lt;BR /&gt;, a.TOT_TRM_PRM as AUTO_ANNUAL_PREMIUM&lt;BR /&gt;From stg_prs_qpmis.vw_caasmstr a (nolock)&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;Store CAAS into 'lib://PRS_Auto_Inforce_QVD/CAAS_CAR_$(i).qvd' (qvd);&lt;/P&gt;&lt;P&gt;drop table CAAS;&lt;BR /&gt;next i;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 07:09:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Iterative-Calculation-during-Load-in-Qlik/m-p/1515100#M36712</guid>
      <dc:creator>carlcimino</dc:creator>
      <dc:date>2024-11-16T07:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: Iterative Calculation during Load in Qlik</title>
      <link>https://community.qlik.com/t5/App-Development/Iterative-Calculation-during-Load-in-Qlik/m-p/1515105#M36713</link>
      <description>&lt;P&gt;To turn columns into rows you will want to use the CrossTable load prefix. Read up on CrossTable in the&lt;A href="https://help.qlik.com/" target="_blank"&gt; help:&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;</description>
      <pubDate>Fri, 30 Nov 2018 21:47:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Iterative-Calculation-during-Load-in-Qlik/m-p/1515105#M36713</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2018-11-30T21:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: Iterative Calculation during Load in Qlik</title>
      <link>https://community.qlik.com/t5/App-Development/Iterative-Calculation-during-Load-in-Qlik/m-p/1515795#M36738</link>
      <description>&lt;P&gt;Thanks Rob!&amp;nbsp; I got the crosstable load to work for transposing 4 columns to 1.&amp;nbsp; When I add another set of 4 columns (highlighted below) the script runs but it returns nothing for those 4 new columns.&amp;nbsp;&amp;nbsp;Is there something else I have to qualify?&lt;/P&gt;&lt;P&gt;crosstable(UNIT_ID, VIN_NUMBER, 16)&lt;BR /&gt;load *&lt;BR /&gt;;&lt;BR /&gt;Select&lt;BR /&gt;cast(replicate('0',12-len(ltrim(rtrim(a.POLICY_NO))))+ltrim(rtrim(a.POLICY_NO)) as varchar(99)) as POLICY_NUMBER&lt;BR /&gt;, replicate('0',7-len(a.AGENT_NO))+a.AGENT_NO as PROD_N&lt;BR /&gt;, a.SUB_AGENT as SUB_PROD_N&lt;BR /&gt;, a.COMPANY_CODE&lt;BR /&gt;, DATEADD(YEAR, -1,a.EXPRN_DATE) as EFFECTIVE_DATE&lt;BR /&gt;, a.EXPRN_DATE as EXPIRATION_DATE&lt;BR /&gt;, left(a.AS_OF_YYYYMMDD,6) as AS_OF_YYYYMM&lt;BR /&gt;, a.NO_OF_CARS as NUMBER_OF_VEHICLES&lt;BR /&gt;, a.NO_OF_DRVRS as NUMBER_OF_DRIVERS&lt;BR /&gt;, a.SCR_SCORE as INSURANCE_SCORE&lt;BR /&gt;, a.NAME_INSD1 as INSURED_NAME&lt;BR /&gt;, a.INSD_STREET as MAILING_ADDRESS&lt;BR /&gt;, a.INSD_CITY as MAILING_CITY&lt;BR /&gt;, a.INSD_STATE as MAILING_STATE&lt;BR /&gt;, a.INSD_ZIP as MAILING_ZIPCODE&lt;BR /&gt;, a.TOT_TRM_PRM&lt;BR /&gt;, a.SER_NUM_1&lt;BR /&gt;, a.SER_NUM_2&lt;BR /&gt;, a.SER_NUM_3&lt;BR /&gt;, a.SER_NUM_4&lt;BR /&gt;&lt;STRONG&gt;, a.MODEL_YR1&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;, a.MODEL_YR2&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;, a.MODEL_YR3&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;, a.MODEL_YR4&lt;/STRONG&gt;&lt;BR /&gt;From stg_prs_qpmis.vw_caasmstr a (nolock)&lt;BR /&gt;where ltrim(rtrim(a.POLICY_NO))='15966244'&lt;BR /&gt;;&lt;BR /&gt;exit script;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Dec 2018 17:40:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Iterative-Calculation-during-Load-in-Qlik/m-p/1515795#M36738</guid>
      <dc:creator>carlcimino</dc:creator>
      <dc:date>2018-12-03T17:40:56Z</dc:date>
    </item>
    <item>
      <title>Re: Iterative Calculation during Load in Qlik</title>
      <link>https://community.qlik.com/t5/App-Development/Iterative-Calculation-during-Load-in-Qlik/m-p/1517015#M36838</link>
      <description>&lt;P&gt;this was solved in the following thread by&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/18624"&gt;@Gysbert_Wassenaar&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/t5/Qlik-Sense-App-Development/Pivot-multiple-columns-to-rows-in-load-script/m-p/1516955#M36821" target="_blank"&gt;https://community.qlik.com/t5/Qlik-Sense-App-Development/Pivot-multiple-columns-to-rows-in-load-script/m-p/1516955#M36821&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Dec 2018 19:54:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Iterative-Calculation-during-Load-in-Qlik/m-p/1517015#M36838</guid>
      <dc:creator>carlcimino</dc:creator>
      <dc:date>2018-12-05T19:54:50Z</dc:date>
    </item>
  </channel>
</rss>

