<?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: Determine status in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Determine-status/m-p/1745572#M57219</link>
    <description>&lt;P&gt;Hey, this should do it:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;tempA:
LOAD * INLINE [
IdA,Description
1,Order 1
2,Order 2
3,Order 3
];

[Table B]:
LOAD * INLINE [
IdB,IdA,Status
1,1,0
2,1,1
3,2,0
4,2,0
5,2,0
6,3,1
7,3,1
];

[ml_open_closed]:
MAPPING LOAD * INLINE [
From,To
1,Open
0,Closed
];

Tmp:
LOAD
IdA,
Max(IdB) as IdB
RESIDENT [Table B]
GROUP BY IdA;

LEFT JOIN (Tmp)
LOAD
IdA,
IdB,
APPLYMAP('ml_open_closed',Status) as NewField
RESIDENT [Table B];

[ml_new_field]:
MAPPING LOAD
IdA,
NewField
RESIDENT Tmp;

DROP TABLE Tmp;

[Table A]:
LOAD *,
APPLYMAP('ml_new_field',IdA) as NewField
RESIDENT tempA;

DROP TABLE tempA;
&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 21 Sep 2020 11:42:50 GMT</pubDate>
    <dc:creator>RsQK</dc:creator>
    <dc:date>2020-09-21T11:42:50Z</dc:date>
    <item>
      <title>Determine status</title>
      <link>https://community.qlik.com/t5/App-Development/Determine-status/m-p/1745562#M57218</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I've been struggling with a requirement and I can't find a proper solution.&lt;/P&gt;&lt;P&gt;Let's assume I have 2 tables Table A (work orders) and Table B (tasks related to work orders). Table A has a primary key (let's call it IdA) which is also a field in Table B. A work order in Table A will be closed once all its tasks are closed in Table B (status 0). So relationship between tables is 1..N (N could be 0) and status of a work order is given by the status of the tasks associated.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table A&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;IdA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Description&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;New Calculated field&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Order1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Open&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Order 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Closed&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Order3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Open&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table B&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;IdB&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;IdA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Status&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;6&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;7&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Àlex&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2021 20:02:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Determine-status/m-p/1745562#M57218</guid>
      <dc:creator>agbcn</dc:creator>
      <dc:date>2021-12-21T20:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: Determine status</title>
      <link>https://community.qlik.com/t5/App-Development/Determine-status/m-p/1745572#M57219</link>
      <description>&lt;P&gt;Hey, this should do it:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;tempA:
LOAD * INLINE [
IdA,Description
1,Order 1
2,Order 2
3,Order 3
];

[Table B]:
LOAD * INLINE [
IdB,IdA,Status
1,1,0
2,1,1
3,2,0
4,2,0
5,2,0
6,3,1
7,3,1
];

[ml_open_closed]:
MAPPING LOAD * INLINE [
From,To
1,Open
0,Closed
];

Tmp:
LOAD
IdA,
Max(IdB) as IdB
RESIDENT [Table B]
GROUP BY IdA;

LEFT JOIN (Tmp)
LOAD
IdA,
IdB,
APPLYMAP('ml_open_closed',Status) as NewField
RESIDENT [Table B];

[ml_new_field]:
MAPPING LOAD
IdA,
NewField
RESIDENT Tmp;

DROP TABLE Tmp;

[Table A]:
LOAD *,
APPLYMAP('ml_new_field',IdA) as NewField
RESIDENT tempA;

DROP TABLE tempA;
&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 21 Sep 2020 11:42:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Determine-status/m-p/1745572#M57219</guid>
      <dc:creator>RsQK</dc:creator>
      <dc:date>2020-09-21T11:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: Determine status</title>
      <link>https://community.qlik.com/t5/App-Development/Determine-status/m-p/1745866#M57242</link>
      <description>&lt;P&gt;Thanks! It worked!&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Àlex&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 08:04:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Determine-status/m-p/1745866#M57242</guid>
      <dc:creator>agbcn</dc:creator>
      <dc:date>2020-09-22T08:04:56Z</dc:date>
    </item>
  </channel>
</rss>

