<?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: Concatenate and synthetic key created - why ? in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Concatenate-and-synthetic-key-created-why/m-p/1842244#M69734</link>
    <description>&lt;P&gt;As long as all the fieldnames are exactly same with no extra or less field count, and no explicit 'noconcatenate' keyword, the tables must be concatenated, may be you need to check the script again, also check each and every line of the log window, sometimes it gives the indication of the location its doing something wrong.&lt;/P&gt;</description>
    <pubDate>Tue, 05 Oct 2021 13:41:41 GMT</pubDate>
    <dc:creator>Digvijay_Singh</dc:creator>
    <dc:date>2021-10-05T13:41:41Z</dc:date>
    <item>
      <title>Concatenate and synthetic key created - why ?</title>
      <link>https://community.qlik.com/t5/App-Development/Concatenate-and-synthetic-key-created-why/m-p/1841840#M69714</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I'm loading 2 tables in two different load sections. I then concatenate both in a third section. After hours trying eveything : qualify/unqualify, noconcatenate, field renaming...I can't get rid of the syn key automatically created...I can't even understand why a syn key is created for a concatenation load.&lt;/P&gt;&lt;P&gt;First section:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;LIB CONNECT TO 'XXX';
LOAD
	text (COMMANDE)&amp;amp;'_'&amp;amp;num(POSTE) as key,
  	[COMMANDE]
    ,[ORIGINE]
	,[POSTE]
	,TYPE_COMMANDE as TYPE_cde
    ,[SECTEUR] as [Sector]
    ,[BUSINESS_UNIT] as [Business unit]
     , year (DATE_MAD)&amp;amp; num(week(DATE_MAD),'00') as YEAR_WEEK_REF_TAUX_SERVICE
[SALES_Temp]:
SELECT "ORIGINE"
	,"COMMANDE"
	,"POSTE"
	,"NET_POSTE"
	,"QTE_POSTE"
	,"SECTEUR"
	,"BUSINESS_UNIT"
    ,"TYPE_COMMANDE"
   ,"DATE_MAD"
  
    
FROM "QLIK"."ZSQ042" WHERE date_creation_poste&amp;gt;'01/07/2021' and QTE_POSTE&amp;gt;0 and TYPE_COMMANDE='TA';
//FROM "QLIK"."ZSQ042_TEST"; 
;


&lt;/LI-CODE&gt;&lt;P&gt;Second section&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[ZSQ042_TEMP]:
LOAD
	key //commande &amp;amp; poste
    ,[COMMANDE]
    ,[POSTE]
    , YEAR_WEEK_REF_TAUX_SERVICE
    , WEEK_SM_REELLE_ZSQ
    
    ,[ORIGINE]
    ,[Business unit]
    ,[Sector]
    ,TYPE_cde
    
 resident [SALES_Temp]
 where num(WEEK_SM_REELLE_ZSQ) &amp;gt; num(YEAR_WEEK_REF_TAUX_SERVICE)
 ;
 
 
//on duplique toutes les lignes qui ne sont pas livrées à la semaine annoncée
 
 TempTable:
Load
  distinct
  key &amp;amp; '^' &amp;amp; COMMANDE &amp;amp; '^' &amp;amp; POSTE &amp;amp; '^' &amp;amp; YEAR_WEEK_REF_TAUX_SERVICE &amp;amp; '^' &amp;amp; WEEK_SM_REELLE_ZSQ &amp;amp; '^' &amp;amp;
  [ORIGINE] &amp;amp; '^' &amp;amp; [Business unit] &amp;amp; '^' &amp;amp; [Sector] &amp;amp; '^' &amp;amp; TYPE_cde
  as Id_Weeks
Resident
  [ZSQ042_TEMP]
;


// for each record in Id_Dates field
for i = 2 to FieldValueCount('Id_Weeks')
 
 // get the current iteration value
  let value = FieldValue('Id_Weeks', $(i));
  
  // extract the Id
  let currentId = SubField('$(value)', '^', 1);
  
  //Extract Order Number
  let currentOrder = SubField('$(value)', '^', 2);
  
  //Extract Order Line Number
  let currentLine = SubField('$(value)', '^', 3);
    
  // extract week to be delivered  
  let currentWeekStart = Num(SubField('$(value)', '^', 4));
  
  // extract week of delivery
  let currentWeekEnd = Num(SubField('$(value)', '^', 5));
  
  // extract origin
  let currentOrigin = SubField('$(value)', '^', 6);
  
  // extract BU
  let currentBU = SubField('$(value)', '^', 7);

// extract Sector
  let currentSector = SubField('$(value)', '^', 8);
  
  // extract Type de commande
  let currentType = SubField('$(value)', '^', 9);
   
// autogenerate all weeks between the week to deliver and week of delivery
   // add the current Id value (this will link to the RawData table)


LATE_DELIVERIES_TEMP:
  NoConcatenate LOAD 
    '$(currentId)' as key_temp,
    '$(currentOrder)' as COMMANDE_temp,
    '$(currentLine)' as POSTE_temp,
    '$(currentWeekStart)' as INITIAL_YEAR_WEEK_REF_TAUX_SERVICE_temp,
    $(currentWeekStart) + IterNo() as YEAR_WEEK_REF_TAUX_SERVICE_temp, //IterNo()-1
    '$(currentWeekEnd)' as WEEK_SM_REELLE_ZSQ_temp,
    IterNo() as Nb_Weeks_Late_temp,
    
    
    '$(currentOrigin)' as ORIGINE_temp,
    '$(currentBU)' as Business_unit_temp,
    '$(currentSector)' as Sector_temp,
    '$(currentType)' as TYPE_cde_temp
    
    
    
  AUTOGENERATE (1)
  WHILE 
    $(currentWeekStart) + IterNo() &amp;lt;= $(currentWeekEnd) //IterNo()-1
  ;

next

// we dont need this table anymore
Drop Table TempTable;
Drop Table ZSQ042_TEMP;&lt;/LI-CODE&gt;&lt;P&gt;Third section&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[SALES] :
load * resident [SALES_Temp];
drop table [SALES_Temp];

Concatenate [SALES]:
Load 
key_temp as key,
COMMANDE_temp as COMMANDE,
POSTE_temp as POSTE,
INITIAL_YEAR_WEEK_REF_TAUX_SERVICE_temp as INITIAL_YEAR_WEEK_REF_TAUX_SERVICE,
YEAR_WEEK_REF_TAUX_SERVICE_temp as YEAR_WEEK_REF_TAUX_SERVICE,
WEEK_SM_REELLE_ZSQ_temp as WEEK_SM_REELLE_ZSQ,
Nb_Weeks_Late_temp as Nb_Weeks_Late,
ORIGINE_temp as ORIGINE,
Business_unit_temp as Business_unit,
Sector_temp as Sector,
TYPE_cde_temp as TYPE_cde
Resident LATE_DELIVERIES_TEMP;
Drop Table LATE_DELIVERIES_TEMP;&lt;/LI-CODE&gt;&lt;P&gt;Result :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="patricesalem_0-1633390041842.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/63332i7BDD7CBF14861801/image-size/medium?v=v2&amp;amp;px=400" role="button" title="patricesalem_0-1633390041842.png" alt="patricesalem_0-1633390041842.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea what I'm doing wrong ?&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 00:02:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Concatenate-and-synthetic-key-created-why/m-p/1841840#M69714</guid>
      <dc:creator>patricesalem</dc:creator>
      <dc:date>2021-10-05T00:02:12Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate and synthetic key created - why ?</title>
      <link>https://community.qlik.com/t5/App-Development/Concatenate-and-synthetic-key-created-why/m-p/1841862#M69716</link>
      <description>&lt;P&gt;Can you share data model image? Haven't seen in detail but this section looks like is written in the loop and for each iteration it looks like creating new table that might cause synthetic key -&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;LATE_DELIVERIES_TEMP:
  NoConcatenate LOAD 
    '$(currentId)' as key_temp,
    '$(currentOrder)' as COMMANDE_tem&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Oct 2021 03:16:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Concatenate-and-synthetic-key-created-why/m-p/1841862#M69716</guid>
      <dc:creator>Digvijay_Singh</dc:creator>
      <dc:date>2021-10-05T03:16:33Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate and synthetic key created - why ?</title>
      <link>https://community.qlik.com/t5/App-Development/Concatenate-and-synthetic-key-created-why/m-p/1841934#M69717</link>
      <description>&lt;P&gt;Hello Digvijay_Singh&lt;/P&gt;&lt;P&gt;It looks like you might have found the issue...it takes ages to create the data model, here is a screenshot after 5min of process :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="patricesalem_0-1633416711968.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/63350i58890D237D0DF7CC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="patricesalem_0-1633416711968.png" alt="patricesalem_0-1633416711968.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;How could I fix the issue in the loop ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 06:52:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Concatenate-and-synthetic-key-created-why/m-p/1841934#M69717</guid>
      <dc:creator>patricesalem</dc:creator>
      <dc:date>2021-10-05T06:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate and synthetic key created - why ?</title>
      <link>https://community.qlik.com/t5/App-Development/Concatenate-and-synthetic-key-created-why/m-p/1842144#M69728</link>
      <description>&lt;P&gt;I don't know the overall requirements but any reason you are using Noconcatenate in the load inside loop, if you remove that, automatically you will have just a single table with all the data concatenated.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 12:01:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Concatenate-and-synthetic-key-created-why/m-p/1842144#M69728</guid>
      <dc:creator>Digvijay_Singh</dc:creator>
      <dc:date>2021-10-05T12:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate and synthetic key created - why ?</title>
      <link>https://community.qlik.com/t5/App-Development/Concatenate-and-synthetic-key-created-why/m-p/1842201#M69732</link>
      <description>&lt;P&gt;no reason...it was just one of my trials....&lt;/P&gt;&lt;P&gt;I've tried using the following code and removing the third section (the one that was concatenating) tables :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[ZSQ042_TEMP]:
LOAD
	key //commande &amp;amp; poste
    ,[COMMANDE]
    ,[POSTE]
    , YEAR_WEEK_REF_TAUX_SERVICE
    , WEEK_SM_REELLE_ZSQ
    
    ,[ORIGINE]
    ,[Business unit]
    ,[Sector]
    ,TYPE_cde
    
    
 resident [SALES]
 where num(WEEK_SM_REELLE_ZSQ) &amp;gt; num(YEAR_WEEK_REF_TAUX_SERVICE)
 ;
 
 
//on duplique toutes les lignes qui ne sont pas livrées à la semaine annoncée
 
 TempTable:
Load
  distinct
  key &amp;amp; '^' &amp;amp; COMMANDE &amp;amp; '^' &amp;amp; POSTE &amp;amp; '^' &amp;amp; YEAR_WEEK_REF_TAUX_SERVICE &amp;amp; '^' &amp;amp; WEEK_SM_REELLE_ZSQ &amp;amp; '^' &amp;amp;
  [ORIGINE] &amp;amp; '^' &amp;amp; [Business unit] &amp;amp; '^' &amp;amp; [Sector] &amp;amp; '^' &amp;amp; TYPE_cde
  as Id_Weeks
Resident
  [ZSQ042_TEMP]
;


// for each record in Id_Dates field
for i = 2 to FieldValueCount('Id_Weeks')
 
 // get the current iteration value
  let value = FieldValue('Id_Weeks', $(i));
  
  // extract the Id
  let currentId = SubField('$(value)', '^', 1);
  
  //Extract Order Number
  let currentOrder = SubField('$(value)', '^', 2);
  
  //Extract Order Line Number
  let currentLine = SubField('$(value)', '^', 3);
    
  // extract week to be delivered  
  let currentWeekStart = Num(SubField('$(value)', '^', 4));
  
  // extract week of delivery
  let currentWeekEnd = Num(SubField('$(value)', '^', 5));
  
  // extract origin
  let currentOrigin = SubField('$(value)', '^', 6);
  
  // extract BU
  let currentBU = SubField('$(value)', '^', 7);

// extract Sector
  let currentSector = SubField('$(value)', '^', 8);
  
  // extract Type de commande
  let currentType = SubField('$(value)', '^', 9);
   
// autogenerate all weeks between the week to deliver and week of delivery
   // add the current Id value (this will link to the RawData table)


LATE_DELIVERIES_TEMP:
  LOAD 
    '$(currentId)' as key,
    '$(currentOrder)' as COMMANDE,
    '$(currentLine)' as POSTE_temp,
    '$(currentWeekStart)' as INITIAL_YEAR_WEEK_REF_TAUX_SERVICE,
    $(currentWeekStart) + IterNo() as YEAR_WEEK_REF_TAUX_SERVICE, //IterNo()-1
    '$(currentWeekEnd)' as WEEK_SM_REELLE_ZSQ,
    IterNo() as Nb_Weeks_Late,
    
    
    '$(currentOrigin)' as ORIGINE,
    '$(currentBU)' as Business_unit,
    '$(currentSector)' as Sector,
    '$(currentType)' as TYPE_cde
    
    
    
  AUTOGENERATE (1)
  WHILE 
    $(currentWeekStart) + IterNo() &amp;lt;= $(currentWeekEnd) //IterNo()-1
  ;

next

// we dont need this table anymore
Drop Table TempTable;
Drop Table ZSQ042_TEMP;
Drop Table LATE_DELIVERIES_TEMP;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No data is added to SALES. I thought that using the same field names in LATE_DELIVERIES_TEMP than SALES, the inline data would automatically concatenated into SALES. It's not the case...What am I doing wrong ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;THANKS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 13:12:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Concatenate-and-synthetic-key-created-why/m-p/1842201#M69732</guid>
      <dc:creator>patricesalem</dc:creator>
      <dc:date>2021-10-05T13:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate and synthetic key created - why ?</title>
      <link>https://community.qlik.com/t5/App-Development/Concatenate-and-synthetic-key-created-why/m-p/1842244#M69734</link>
      <description>&lt;P&gt;As long as all the fieldnames are exactly same with no extra or less field count, and no explicit 'noconcatenate' keyword, the tables must be concatenated, may be you need to check the script again, also check each and every line of the log window, sometimes it gives the indication of the location its doing something wrong.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 13:41:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Concatenate-and-synthetic-key-created-why/m-p/1842244#M69734</guid>
      <dc:creator>Digvijay_Singh</dc:creator>
      <dc:date>2021-10-05T13:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate and synthetic key created - why ?</title>
      <link>https://community.qlik.com/t5/App-Development/Concatenate-and-synthetic-key-created-why/m-p/1842276#M69735</link>
      <description>&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;I have less fields in the "loop created table". In another qvf, I can manage to concatenate two tables that don't have the same number of fields....how can I do with my current approach ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 14:14:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Concatenate-and-synthetic-key-created-why/m-p/1842276#M69735</guid>
      <dc:creator>patricesalem</dc:creator>
      <dc:date>2021-10-05T14:14:20Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate and synthetic key created - why ?</title>
      <link>https://community.qlik.com/t5/App-Development/Concatenate-and-synthetic-key-created-why/m-p/1842279#M69736</link>
      <description>&lt;P&gt;Then you should use force concatenation using concatenate keyword..&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 14:16:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Concatenate-and-synthetic-key-created-why/m-p/1842279#M69736</guid>
      <dc:creator>Digvijay_Singh</dc:creator>
      <dc:date>2021-10-05T14:16:54Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate and synthetic key created - why ?</title>
      <link>https://community.qlik.com/t5/App-Development/Concatenate-and-synthetic-key-created-why/m-p/1842291#M69737</link>
      <description>&lt;P&gt;I have tried the following with no luck :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Concatenate [SALES]:
//LATE_DELIVERIES_TEMP:
  LOAD 
    '$(currentId)' as key,
    '$(currentOrder)' as COMMANDE,
    '$(currentLine)' as POSTE_temp,
    '$(currentWeekStart)' as INITIAL_YEAR_WEEK_REF_TAUX_SERVICE,
    $(currentWeekStart) + IterNo() as YEAR_WEEK_REF_TAUX_SERVICE, //IterNo()-1
    '$(currentWeekEnd)' as WEEK_SM_REELLE_ZSQ,
    //IterNo() as Nb_Weeks_Late,
    'TOTO' as Nb_Weeks_Late,
    
    '$(currentOrigin)' as ORIGINE,
    '$(currentBU)' as Business_unit,
    '$(currentSector)' as Sector,
    '$(currentType)' as TYPE_cde
    
    
    
  AUTOGENERATE (1)
  WHILE 
    $(currentWeekStart) + IterNo() &amp;lt;= $(currentWeekEnd) //IterNo()-1
  ;

next

// we dont need this table anymore
Drop Table TempTable;
Drop Table ZSQ042_TEMP;
//Drop Table LATE_DELIVERIES_TEMP;
drop table ORDER_Shipped;&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 05 Oct 2021 14:26:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Concatenate-and-synthetic-key-created-why/m-p/1842291#M69737</guid>
      <dc:creator>patricesalem</dc:creator>
      <dc:date>2021-10-05T14:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate and synthetic key created - why ?</title>
      <link>https://community.qlik.com/t5/App-Development/Concatenate-and-synthetic-key-created-why/m-p/1842327#M69739</link>
      <description>&lt;P&gt;I did find !&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[ZSQ042_TEMP]:
LOAD
	key //commande &amp;amp; poste
    ,[COMMANDE]
    ,[POSTE]
    , YEAR_WEEK_REF_TAUX_SERVICE
    , WEEK_SM_REELLE_ZSQ
    
    ,[ORIGINE]
    ,[Business unit]
    ,[Sector]
    ,TYPE_cde
    
   
 resident [SALES_TEMP]
 where num(WEEK_SM_REELLE_ZSQ) &amp;gt; num(YEAR_WEEK_REF_TAUX_SERVICE)
 ;
 
 
//on duplique toutes les lignes qui ne sont pas livrées à la semaine annoncée
 
 TempTable:
Load
  distinct
  key &amp;amp; '^' &amp;amp; COMMANDE &amp;amp; '^' &amp;amp; POSTE &amp;amp; '^' &amp;amp; YEAR_WEEK_REF_TAUX_SERVICE &amp;amp; '^' &amp;amp; WEEK_SM_REELLE_ZSQ &amp;amp; '^' &amp;amp;
  [ORIGINE] &amp;amp; '^' &amp;amp; [Business unit] &amp;amp; '^' &amp;amp; [Sector] &amp;amp; '^' &amp;amp; TYPE_cde
  as Id_Weeks
Resident
  [ZSQ042_TEMP]
;


// for each record in Id_Dates field
for i = 2 to FieldValueCount('Id_Weeks')
 
 // get the current iteration value
  let value = FieldValue('Id_Weeks', $(i));
  
  // extract the Id
  let currentId = SubField('$(value)', '^', 1);
  
  //Extract Order Number
  let currentOrder = SubField('$(value)', '^', 2);
  
  //Extract Order Line Number
  let currentLine = SubField('$(value)', '^', 3);
    
  // extract week to be delivered  
  let currentWeekStart = Num(SubField('$(value)', '^', 4));
  
  // extract week of delivery
  let currentWeekEnd = Num(SubField('$(value)', '^', 5));
  
  // extract origin
  let currentOrigin = SubField('$(value)', '^', 6);
  
  // extract BU
  let currentBU = SubField('$(value)', '^', 7);

// extract Sector
  let currentSector = SubField('$(value)', '^', 8);
  
  // extract Type de commande
  let currentType = SubField('$(value)', '^', 9);
   
// autogenerate all weeks between the week to deliver and week of delivery
   // add the current Id value (this will link to the RawData table)

LATE_DELIVERIES_TEMP:
  LOAD 
    '$(currentId)' as key,
    '$(currentOrder)' as COMMANDE,
    '$(currentLine)' as POSTE_temp,
    '$(currentWeekStart)' as INITIAL_YEAR_WEEK_REF_TAUX_SERVICE,
    $(currentWeekStart) + IterNo() as YEAR_WEEK_REF_TAUX_SERVICE, //IterNo()-1
    '$(currentWeekEnd)' as WEEK_SM_REELLE_ZSQ,
    //IterNo() as Nb_Weeks_Late,
    'TOTO' as Nb_Weeks_Late,
    
    '$(currentOrigin)' as ORIGINE,
    '$(currentBU)' as Business_unit,
    '$(currentSector)' as Sector,
    '$(currentType)' as TYPE_cde
    
    
    
  AUTOGENERATE (1)
  WHILE 
    $(currentWeekStart) + IterNo() &amp;lt;= $(currentWeekEnd) //IterNo()-1
  ;

next



// we dont need this table anymore
Drop Table TempTable;
Drop Table ZSQ042_TEMP;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the next section :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[SALES] :
load key,COMMANDE,Nb_Weeks_Late
resident [SALES_TEMP];
drop table [SALES_TEMP];

Concatenate [SALES]:
Load key,COMMANDE,Nb_Weeks_Late
resident [LATE_DELIVERIES_TEMP];

Drop Table LATE_DELIVERIES_TEMP;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I try the following (to avoid capturing all fields from Sales_Temp), it does not work. Why do you think ?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[SALES] :
load *
resident [SALES_TEMP];
drop table [SALES_TEMP];

Concatenate [SALES]:
Load key,COMMANDE,Nb_Weeks_Late
resident [LATE_DELIVERIES_TEMP];

Drop Table LATE_DELIVERIES_TEMP;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;THANKS A LOT&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 15:03:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Concatenate-and-synthetic-key-created-why/m-p/1842327#M69739</guid>
      <dc:creator>patricesalem</dc:creator>
      <dc:date>2021-10-05T15:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate and synthetic key created - why ?</title>
      <link>https://community.qlik.com/t5/App-Development/Concatenate-and-synthetic-key-created-why/m-p/1842346#M69741</link>
      <description>&lt;P&gt;Not sure how this statement Concatenate [Sales]: is processed. You don't need to use table identifier [Sales]: as the next load is going to concatenate. Do you want to write Concatenate([Sales]) instead? that makes sense to me.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 15:17:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Concatenate-and-synthetic-key-created-why/m-p/1842346#M69741</guid>
      <dc:creator>Digvijay_Singh</dc:creator>
      <dc:date>2021-10-05T15:17:45Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate and synthetic key created - why ?</title>
      <link>https://community.qlik.com/t5/App-Development/Concatenate-and-synthetic-key-created-why/m-p/1842490#M69750</link>
      <description>&lt;P&gt;Thanks a lot for your help ! I managed to get it work as simple as possible, just using the right syntax as you've indicated in your last post !&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[ZSQ042_TEMP]:
LOAD
	key //commande &amp;amp; poste
    ,[COMMANDE]
    ,[POSTE]
    , YEAR_WEEK_REF_TAUX_SERVICE
    , WEEK_SM_REELLE_ZSQ
    
    ,[ORIGINE]
    ,[Business unit]
    ,[Sector]
    ,TYPE_cde
    
 resident [SALES]
 where num(WEEK_SM_REELLE_ZSQ) &amp;gt; num(YEAR_WEEK_REF_TAUX_SERVICE)
 ;
 
 
//on duplique toutes les lignes qui ne sont pas livrées à la semaine annoncée
 
 TempTable:
Load
  distinct
  key &amp;amp; '^' &amp;amp; COMMANDE &amp;amp; '^' &amp;amp; POSTE &amp;amp; '^' &amp;amp; YEAR_WEEK_REF_TAUX_SERVICE &amp;amp; '^' &amp;amp; WEEK_SM_REELLE_ZSQ &amp;amp; '^' &amp;amp;
  [ORIGINE] &amp;amp; '^' &amp;amp; [Business unit] &amp;amp; '^' &amp;amp; [Sector] &amp;amp; '^' &amp;amp; TYPE_cde
  as Id_Weeks
Resident
  [ZSQ042_TEMP]
;


// for each record in Id_Dates field
for i = 2 to FieldValueCount('Id_Weeks')
 
 // get the current iteration value
  let value = FieldValue('Id_Weeks', $(i));
  
  // extract the Id
  let currentId = SubField('$(value)', '^', 1);
  
  //Extract Order Number
  let currentOrder = SubField('$(value)', '^', 2);
  
  //Extract Order Line Number
  let currentLine = SubField('$(value)', '^', 3);
    
  // extract week to be delivered  
  let currentWeekStart = Num(SubField('$(value)', '^', 4));
  
  // extract week of delivery
  let currentWeekEnd = Num(SubField('$(value)', '^', 5));
  
  // extract origin
  let currentOrigin = SubField('$(value)', '^', 6);
  
  // extract BU
  let currentBU = SubField('$(value)', '^', 7);

// extract Sector
  let currentSector = SubField('$(value)', '^', 8);
  
  // extract Type de commande
  let currentType = SubField('$(value)', '^', 9);
   
// autogenerate all weeks between the week to deliver and week of delivery
   // add the current Id value (this will link to the RawData table)


Concatenate([SALES])
LOAD 
    '$(currentId)' as key,
    '$(currentOrder)' as COMMANDE,
    '$(currentLine)' as POSTE,
    '$(currentWeekStart)' as INITIAL_YEAR_WEEK_REF_TAUX_SERVICE,
    $(currentWeekStart) + IterNo() as YEAR_WEEK_REF_TAUX_SERVICE, //IterNo()-1
    '$(currentWeekEnd)' as WEEK_SM_REELLE_ZSQ,
    IterNo() as Nb_Weeks_Late,
   
    
    
    '$(currentOrigin)' as ORIGINE,
    '$(currentBU)' as Business_unit,
    '$(currentSector)' as Sector,
    '$(currentType)' as TYPE_cde
    
    
    
  AUTOGENERATE (1)
  WHILE 
    $(currentWeekStart) + IterNo() &amp;lt;= $(currentWeekEnd) //IterNo()-1
  ;

next

// we dont need this table anymore
Drop Table TempTable;
Drop Table ZSQ042_TEMP;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 19:51:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Concatenate-and-synthetic-key-created-why/m-p/1842490#M69750</guid>
      <dc:creator>patricesalem</dc:creator>
      <dc:date>2021-10-05T19:51:08Z</dc:date>
    </item>
  </channel>
</rss>

