<?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: How to insert different Id based on a KeyField Challenge in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/How-to-insert-different-Id-based-on-a-KeyField-Challenge/m-p/1704707#M54021</link>
    <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/28589"&gt;@marcel_olmo&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I made a quick response, this script can be optimised.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Data:
LOAD autonumber(Id&amp;amp;Field) as ID1, * INLINE [
    Id, Field
    100, OtherField1
    101, KeyField
    102, OtherField1
    103, OtherField1
    104, KeyField
    105, OtherField1
    106, KeyField
    107, OtherField1
    108, OtherField1
    109, KeyField
    110, OtherField1
];



Temp:
noconcatenate

load rowno() as ID2,* resident Data where Field='KeyField';
join load * resident Data;
drop table Data;

Data2:
noconcatenate
load * resident Temp order by Id;
drop table Temp;
let a=peek('Id',0);
output:
noconcatenate
load *,if(ID1=1,'$(a)',if(isnull(ID2),peek('IDtmp'),ID2)) as IDtmp resident Data2;
drop table Data2;
drop field ID1,Id,ID2;
rename field IDtmp to Id;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ouput:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 862px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/34258i5E91D1F0323C9A46/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 24 May 2020 01:30:15 GMT</pubDate>
    <dc:creator>Taoufiq_Zarra</dc:creator>
    <dc:date>2020-05-24T01:30:15Z</dc:date>
    <item>
      <title>How to insert different Id based on a KeyField Challenge</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-insert-different-Id-based-on-a-KeyField-Challenge/m-p/1704702#M54020</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;I have an Input Table with some raw data where I have Ids based on autonumber and some fields that looks like this :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Id1.PNG" style="width: 214px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/34256iB93078AB3FCDCFF5/image-size/large?v=v2&amp;amp;px=999" role="button" title="Id1.PNG" alt="Id1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and I'd like to change the Id that is related with a "&lt;STRONG&gt;keyField&lt;/STRONG&gt;" because it means that it begins a new slot of a product. My desired result would be something like this :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Id2.PNG" style="width: 163px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/34257i7B6EA97EC536B22A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Id2.PNG" alt="Id2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;How could you do this? Could you help me?&lt;/P&gt;&lt;P&gt;I've attached this example in an excel with the input and the desiredOutputTable.&lt;/P&gt;&lt;P&gt;Best regards, Marcel.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 18:35:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-insert-different-Id-based-on-a-KeyField-Challenge/m-p/1704702#M54020</guid>
      <dc:creator>marcel_olmo</dc:creator>
      <dc:date>2024-11-16T18:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert different Id based on a KeyField Challenge</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-insert-different-Id-based-on-a-KeyField-Challenge/m-p/1704707#M54021</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/28589"&gt;@marcel_olmo&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I made a quick response, this script can be optimised.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Data:
LOAD autonumber(Id&amp;amp;Field) as ID1, * INLINE [
    Id, Field
    100, OtherField1
    101, KeyField
    102, OtherField1
    103, OtherField1
    104, KeyField
    105, OtherField1
    106, KeyField
    107, OtherField1
    108, OtherField1
    109, KeyField
    110, OtherField1
];



Temp:
noconcatenate

load rowno() as ID2,* resident Data where Field='KeyField';
join load * resident Data;
drop table Data;

Data2:
noconcatenate
load * resident Temp order by Id;
drop table Temp;
let a=peek('Id',0);
output:
noconcatenate
load *,if(ID1=1,'$(a)',if(isnull(ID2),peek('IDtmp'),ID2)) as IDtmp resident Data2;
drop table Data2;
drop field ID1,Id,ID2;
rename field IDtmp to Id;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ouput:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 862px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/34258i5E91D1F0323C9A46/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 24 May 2020 01:30:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-insert-different-Id-based-on-a-KeyField-Challenge/m-p/1704707#M54021</guid>
      <dc:creator>Taoufiq_Zarra</dc:creator>
      <dc:date>2020-05-24T01:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert different Id based on a KeyField Challenge</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-insert-different-Id-based-on-a-KeyField-Challenge/m-p/1704732#M54024</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/56648"&gt;@Taoufiq_Zarra&lt;/a&gt;&amp;nbsp;that's what I was looking for and it worked fine.&lt;/P&gt;&lt;P&gt;Best regards, Marcel.&lt;/P&gt;</description>
      <pubDate>Sun, 24 May 2020 09:23:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-insert-different-Id-based-on-a-KeyField-Challenge/m-p/1704732#M54024</guid>
      <dc:creator>marcel_olmo</dc:creator>
      <dc:date>2020-05-24T09:23:15Z</dc:date>
    </item>
  </channel>
</rss>

