<?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: Flaged row not being stored in QVD/Left join in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Flaged-row-not-being-stored-in-QVD-Left-join/m-p/2484144#M101123</link>
    <description>&lt;P&gt;Hi, if you do the join using the same&amp;nbsp;&lt;SPAN&gt;vAnsweredFlag field, but the value has changed (like from null to something), the join wont work as all the fields used for join should have the same values.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can avoid this renaming the first&amp;nbsp;vAnsweredFlag to something like&amp;nbsp;vAnsweredFlag_prev, so using a different field it will do the join of the changed values, but also the loop you shlud also fill the value of this field for the unprocesssed rows.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Another option coud be: Apply the 'IF' conditions in a temporary table before the loop, then you can loop all the rows of this table without the need of any checks, and the end concatenate the modified rows with the existing and unprocessed rows in the qvd to recreate the qvd with all the keys. You can use Exist() to do the check and only add the unprocessed rows from the qvd.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I would reccomend to have a copy of the qvds while developing this, so in case anything doesn't work as expected you can returns to the original state of the flags.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 28 Sep 2024 07:16:24 GMT</pubDate>
    <dc:creator>rubenmarin</dc:creator>
    <dc:date>2024-09-28T07:16:24Z</dc:date>
    <item>
      <title>Flaged row not being stored in QVD/Left join</title>
      <link>https://community.qlik.com/t5/App-Development/Flaged-row-not-being-stored-in-QVD-Left-join/m-p/2483930#M101100</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have this app that does the following: (It's supose to do but is not working properly) :&lt;/P&gt;
&lt;P&gt;Load multiple QVD's and concatenate them.&lt;/P&gt;
&lt;P&gt;This table created from those QVD's will have fields "key" and "request_status" , request_status can have "Pending","Answered" values.&lt;/P&gt;
&lt;P&gt;I then do a loop and check if the request_status is "Answered" in a given row, after that it will store into another new field named AnsweredFlag and give it a value "Answered" so it basicly becomes flagged after the loop.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The flagged keys will then be stored into a qvd and left joined to the original table where all the qvd's are.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My send_email.qvd then won't have the flagged keys and this loop will always send the emails... any clues?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But the issue is that, it stores the values into the table but when I reload the app it seems to not have appended anything to the flags. Please see script:&lt;/P&gt;
&lt;P&gt;My table:&lt;/P&gt;
&lt;P&gt;Requests_triggers:&lt;/P&gt;
&lt;P&gt;Load *&amp;nbsp;FROM [lib://FORMS_DATA (cars2clickvm_radu.chitu)/Deal Monitor Outputs/Deal_Monitor_*_FINAL.qvd] (qvd);&lt;/P&gt;
&lt;P&gt;left join(Requests_triggers)&lt;BR /&gt;LOAD&lt;BR /&gt;key,&lt;BR /&gt;vAnsweredFlag&lt;BR /&gt;FROM [lib://FORMS_DATA (cars2clickvm_radu.chitu)/sent_emails.qvd] (qvd);&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;LIB CONNECT TO 'SMTP - BREVO (cars2clickvm_radu.chitu)';&lt;/P&gt;
&lt;P&gt;// Create a temporary table to collect answered keys&lt;BR /&gt;TempAnsweredKeys:&lt;BR /&gt;LOAD &lt;BR /&gt;'' as TempKey,&lt;BR /&gt;'' as TempAnsweredFlag&lt;BR /&gt;AUTOGENERATE 0;&lt;/P&gt;
&lt;P&gt;//THIS IGNORES THE ONES THAT DONT HAVE THE VANSWEREDflag BECAUSE IT NEVER LOOPS THROUGHT IT&lt;/P&gt;
&lt;P&gt;// Loop through the Requests_triggers&lt;BR /&gt;For i = 0 to NoOfRows('Requests_triggers') - 1&lt;BR /&gt;LET vRecipientName = Peek('KAM', $(i), 'Requests_triggers');&lt;BR /&gt;LET vListname = Peek('listname', $(i), 'Requests_triggers');&lt;BR /&gt;LET vAnsweredFlag = Peek('request_status', $(i), 'Requests_triggers'); //request status check&lt;BR /&gt;LET vFeedback = Peek('reply', $(i), 'Requests_triggers');&lt;BR /&gt;LET vkey = Peek('key', $(i), 'Requests_triggers');&lt;BR /&gt;LET vkey_check = Peek('vAnsweredFlag', $(i), 'Requests_triggers');&lt;/P&gt;
&lt;P&gt;Trace ---------- $(vRecipientName) , $(vAnsweredFlag) , $(vkey_check) , $(vListname);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;//There is always the last keys that's why it doesnt work, i need to find a way to only check the keys added by the loop.&lt;BR /&gt;IF vAnsweredFlag = 'Answered' and (isnull(vkey_check) or vkey_check&amp;lt;&amp;gt;'Answered') then // Check if vkey exists in Sent&lt;BR /&gt;// and vkey_check &amp;lt;&amp;gt; 'Answered'&lt;BR /&gt;// Construct HTML message with personalized content&lt;BR /&gt;LET vMessageHTML = '&lt;BR /&gt;&amp;lt;html&amp;gt;&lt;BR /&gt;&amp;lt;body style="font-family: Arial, sans-serif; color: #333333; line-height: 1.5;"&amp;gt;&lt;BR /&gt;&amp;lt;div style="max-width: 600px; margin: auto; border: 1px solid #dddddd; padding: 20px; border-radius: 8px; background-color: #f9f9f9;"&amp;gt;&lt;BR /&gt;&amp;lt;h2&amp;gt;Hello ' &amp;amp; vRecipientName &amp;amp; '&amp;lt;/h2&amp;gt;&lt;BR /&gt;&amp;lt;h2&amp;gt;List Name : ' &amp;amp; vListname &amp;amp; '&amp;lt;/h2&amp;gt;&lt;BR /&gt;&amp;lt;h2&amp;gt;Feedback : ' &amp;amp; vFeedback &amp;amp; '&amp;lt;/h2&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;';&lt;BR /&gt;&lt;BR /&gt;TRACE ------------------------------- Loop instance $(i) -------------------------------;&lt;/P&gt;
&lt;P&gt;// Add the key to the temporary table&lt;BR /&gt;CONCATENATE (TempAnsweredKeys)&lt;BR /&gt;LOAD &lt;BR /&gt;'$(vkey)' as TempKey,&lt;BR /&gt;'Answered' as TempAnsweredFlag&lt;BR /&gt;AUTOGENERATE 1;&lt;/P&gt;
&lt;P&gt;// Send email using the specified properties&lt;BR /&gt;SENDMAIL:&lt;BR /&gt;LOAD&lt;BR /&gt;'Sent' as [SendEmail.status],&lt;BR /&gt;'Success' as [SendEmail.result],&lt;BR /&gt;'$(vRecipientEmail)' as [RecipientEmail]&lt;BR /&gt;INLINE [&lt;BR /&gt;status, result&lt;BR /&gt;Sent, Success&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;// Load and execute the send email action&lt;BR /&gt;SELECT status,&lt;BR /&gt;result&lt;BR /&gt;FROM SendEmail&lt;BR /&gt;WITH PROPERTIES (&lt;BR /&gt;to='czo@cars2click.com',&lt;BR /&gt;subject='Deal Monitor - You have Feedback',&lt;BR /&gt;message='$(vMessageHTML)',&lt;BR /&gt;html='true',&lt;BR /&gt;fromName='Demo - CZO',&lt;BR /&gt;fromEmail='maria@cars2click.com'&lt;BR /&gt;);&lt;BR /&gt;&lt;BR /&gt;// Finalize the temporary table by concatenating with Sent &lt;BR /&gt;ENDIF;&lt;BR /&gt;Next;&lt;/P&gt;
&lt;P&gt;store TempAnsweredKeys into [lib://FORMS_DATA (cars2clickvm_radu.chitu)/sent_emails_test.qvd] (qvd);&lt;/P&gt;
&lt;P&gt;// Now perform a LEFT JOIN outside the loop to update the Requests_triggers table&lt;BR /&gt;LEFT JOIN (Requests_triggers)&lt;BR /&gt;LOAD&lt;BR /&gt;trim(TempKey) as key,&lt;BR /&gt;TempAnsweredFlag as vAnsweredFlag&lt;BR /&gt;RESIDENT TempAnsweredKeys;&lt;/P&gt;
&lt;P&gt;// Drop the temporary table as it's no longer needed&lt;BR /&gt;DROP TABLE TempAnsweredKeys;&lt;/P&gt;
&lt;P&gt;// Store the final result&lt;BR /&gt;STORE Requests_triggers into [lib://FORMS_DATA (cars2clickvm_radu.chitu)/sent_emails.qvd] (qvd);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 07:09:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Flaged-row-not-being-stored-in-QVD-Left-join/m-p/2483930#M101100</guid>
      <dc:creator>Nolgath</dc:creator>
      <dc:date>2024-09-27T07:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: Flaged row not being stored in QVD/Left join</title>
      <link>https://community.qlik.com/t5/App-Development/Flaged-row-not-being-stored-in-QVD-Left-join/m-p/2484144#M101123</link>
      <description>&lt;P&gt;Hi, if you do the join using the same&amp;nbsp;&lt;SPAN&gt;vAnsweredFlag field, but the value has changed (like from null to something), the join wont work as all the fields used for join should have the same values.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can avoid this renaming the first&amp;nbsp;vAnsweredFlag to something like&amp;nbsp;vAnsweredFlag_prev, so using a different field it will do the join of the changed values, but also the loop you shlud also fill the value of this field for the unprocesssed rows.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Another option coud be: Apply the 'IF' conditions in a temporary table before the loop, then you can loop all the rows of this table without the need of any checks, and the end concatenate the modified rows with the existing and unprocessed rows in the qvd to recreate the qvd with all the keys. You can use Exist() to do the check and only add the unprocessed rows from the qvd.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I would reccomend to have a copy of the qvds while developing this, so in case anything doesn't work as expected you can returns to the original state of the flags.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Sep 2024 07:16:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Flaged-row-not-being-stored-in-QVD-Left-join/m-p/2484144#M101123</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2024-09-28T07:16:24Z</dc:date>
    </item>
  </channel>
</rss>

