<?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 Dropping Fields not in Data Dictionary in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Dropping-Fields-not-in-Data-Dictionary/m-p/2436455#M97036</link>
    <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;
&lt;P&gt;I'm trying to drop fields that are not found in my Mapping Dictionary. I'm using this script:&lt;BR /&gt;&lt;BR /&gt;Let vFieldCount = NoOfFields('&lt;SPAN&gt;_qvd_name&lt;/SPAN&gt;');&lt;BR /&gt;For i = 1 to $(vFieldCount)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Let vFieldName = FieldName($(i), '$(&lt;SPAN&gt;_qvd_name&lt;/SPAN&gt;)');&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; // Check if the field exists in the mapping dictionary&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; If Not WildMatch('$(vFieldName)', '$(DataDictionaryMap.[Standard Field Name])') &lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; // If not found, drop the field from main table&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Then&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Drop Field '$(vFieldName)';&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; End If;&lt;BR /&gt;Next;&lt;/P&gt;
&lt;P&gt;However, I'm getting this syntax error:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="error.png" style="width: 518px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/163124iE36B821E6B8ABF82/image-size/large?v=v2&amp;amp;px=999" role="button" title="error.png" alt="error.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;It is getting the correct field name to check (subject Id). The problem seems to lie in the For loop syntax, but I can't find what the error is.&lt;/P&gt;
&lt;P&gt;Alternatively, does anyone know of a way to drop fields after renaming them? The renaming is working fine, I just need to remove all the extra fields that are not included in the dictionary and were not renamed. Doing it field by field during the load is not feasible.&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 01 Apr 2024 20:12:28 GMT</pubDate>
    <dc:creator>alriveg</dc:creator>
    <dc:date>2024-04-01T20:12:28Z</dc:date>
    <item>
      <title>Dropping Fields not in Data Dictionary</title>
      <link>https://community.qlik.com/t5/App-Development/Dropping-Fields-not-in-Data-Dictionary/m-p/2436455#M97036</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;
&lt;P&gt;I'm trying to drop fields that are not found in my Mapping Dictionary. I'm using this script:&lt;BR /&gt;&lt;BR /&gt;Let vFieldCount = NoOfFields('&lt;SPAN&gt;_qvd_name&lt;/SPAN&gt;');&lt;BR /&gt;For i = 1 to $(vFieldCount)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Let vFieldName = FieldName($(i), '$(&lt;SPAN&gt;_qvd_name&lt;/SPAN&gt;)');&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; // Check if the field exists in the mapping dictionary&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; If Not WildMatch('$(vFieldName)', '$(DataDictionaryMap.[Standard Field Name])') &lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; // If not found, drop the field from main table&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Then&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Drop Field '$(vFieldName)';&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; End If;&lt;BR /&gt;Next;&lt;/P&gt;
&lt;P&gt;However, I'm getting this syntax error:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="error.png" style="width: 518px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/163124iE36B821E6B8ABF82/image-size/large?v=v2&amp;amp;px=999" role="button" title="error.png" alt="error.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;It is getting the correct field name to check (subject Id). The problem seems to lie in the For loop syntax, but I can't find what the error is.&lt;/P&gt;
&lt;P&gt;Alternatively, does anyone know of a way to drop fields after renaming them? The renaming is working fine, I just need to remove all the extra fields that are not included in the dictionary and were not renamed. Doing it field by field during the load is not feasible.&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 20:12:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dropping-Fields-not-in-Data-Dictionary/m-p/2436455#M97036</guid>
      <dc:creator>alriveg</dc:creator>
      <dc:date>2024-04-01T20:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping Fields not in Data Dictionary</title>
      <link>https://community.qlik.com/t5/App-Development/Dropping-Fields-not-in-Data-Dictionary/m-p/2436481#M97038</link>
      <description>&lt;P&gt;You should not use single quotes around the Drop Field fieldname. If you are trying to cover the circumstance where the fieldname contains spaces, use double quotes or square brackets.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Drop Field "$(vFieldName)";&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Note that it can be painfully slow to drop one field at a time. If it's too slow for your needs, modify your loop to collect the fields in a comma separated list and then use a single Drop Field statement.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;-Rob&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 23:45:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dropping-Fields-not-in-Data-Dictionary/m-p/2436481#M97038</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2024-04-01T23:45:36Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping Fields not in Data Dictionary</title>
      <link>https://community.qlik.com/t5/App-Development/Dropping-Fields-not-in-Data-Dictionary/m-p/2436939#M97055</link>
      <description>&lt;P&gt;The quotes change was correct. Now it's getting the correct value for the field names. However, the error seems to be with the "THEN" statement following the "IF NOT WILDMATCH()".&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="alriveg_3-1712073498358.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/163235iBE495BFFBF5419B7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="alriveg_3-1712073498358.png" alt="alriveg_3-1712073498358.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Let vFieldCount = NoOfFields('&lt;/SPAN&gt;&lt;SPAN&gt;_qvd_name&lt;/SPAN&gt;&lt;SPAN&gt;');&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For i = 1 to $(vFieldCount)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Let vFieldName = FieldName($(i), '$(&lt;/SPAN&gt;&lt;SPAN&gt;_qvd_name&lt;/SPAN&gt;&lt;SPAN&gt;)');&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;FONT color="#339966"&gt;// Check if the field exists in the mapping dictionary&lt;/FONT&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; If Not WildMatch('$(vFieldName)', '$(DataDictionaryMap.[Standard Field Name])')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;FONT color="#339966"&gt;// If not found, drop the field from main table&lt;/FONT&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt; Then&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; LET vDrop = Concatenate($(vFieldName), ',')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; End If;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Next;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;I've changed the code to collect the field names in a list, thanks for the suggestion. It's the "THEN" statement that seems to be causing the error. Any suggestions?&lt;/P&gt;
&lt;P&gt;Thanks,&lt;BR /&gt;Alex&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2024 17:38:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dropping-Fields-not-in-Data-Dictionary/m-p/2436939#M97055</guid>
      <dc:creator>alriveg</dc:creator>
      <dc:date>2024-04-02T17:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping Fields not in Data Dictionary</title>
      <link>https://community.qlik.com/t5/App-Development/Dropping-Fields-not-in-Data-Dictionary/m-p/2437493#M97070</link>
      <description>&lt;P&gt;The script syntax for "Control Statements" requires the statement to be on one line. "Then" need to be on the same line as "If"&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;If Not WildMatch('$(vFieldName)', '$(DataDictionaryMap.[Standard Field Name])')&amp;nbsp;&lt;STRONG&gt;Then&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptControlStatements/If.htm" target="_blank"&gt;https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptControlStatements/If.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;-Rob&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2024 16:03:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dropping-Fields-not-in-Data-Dictionary/m-p/2437493#M97070</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2024-04-03T16:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping Fields not in Data Dictionary</title>
      <link>https://community.qlik.com/t5/App-Development/Dropping-Fields-not-in-Data-Dictionary/m-p/2439072#M97146</link>
      <description>&lt;P&gt;That fixed the error, thanks. The problem I'm still having though is that the dropped fields still appear in the data model, despite being dropped.&lt;/P&gt;
&lt;P&gt;That said, I'll mark this as a solution. It did help a lot with the syntax error. Thanks for the help!&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2024 20:18:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dropping-Fields-not-in-Data-Dictionary/m-p/2439072#M97146</guid>
      <dc:creator>alriveg</dc:creator>
      <dc:date>2024-04-08T20:18:55Z</dc:date>
    </item>
  </channel>
</rss>

