<?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: Handling field names with spaces in ODAG script in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Handling-field-names-with-spaces-in-ODAG-script/m-p/1674406#M51171</link>
    <description>&lt;P&gt;Do you get a value for&amp;nbsp;&lt;SPAN&gt;TRACE $(WHERE_PART); in your reload progress while doing the load?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Feb 2020 13:51:53 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2020-02-11T13:51:53Z</dc:date>
    <item>
      <title>Handling field names with spaces in ODAG script</title>
      <link>https://community.qlik.com/t5/App-Development/Handling-field-names-with-spaces-in-ODAG-script/m-p/1674372#M51158</link>
      <description>&lt;P&gt;Good day&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to build an On Demand app using the script below in template app to bind. My problem is that there are certain field names with spaces such as "Customer ID " in script below.The code shows syntax error on all instances where "Customer ID" is included. Unfortunately I cannot change the field names because these fields are used in other systems which would also need to be changed. Is there any way I can go around this problem? I have tried using "", ``, ' ' but none have worked.&lt;/P&gt;&lt;P&gt;//Creates a WHERE statement which can be used in table loads to restrict the data to a smaller set&lt;/P&gt;&lt;P&gt;SUB ExtendWhere(Name, ValVarName)&lt;BR /&gt;LET T = Name &amp;amp; '_COLNAME';&lt;BR /&gt;LET ColName = $(T);&lt;BR /&gt;LET Values = $(ValVarName);&lt;BR /&gt;IF len(Values) &amp;gt; 0 THEN&lt;BR /&gt;IF len(WHERE_PART) &amp;gt; 0 THEN //If WHERE clause exists then extend it with further values&lt;BR /&gt;LET WHERE_PART = '$(WHERE_PART) AND MATCH($(ColName),$(Values))';&lt;BR /&gt;ELSE&lt;BR /&gt;LET WHERE_PART = ' WHERE MATCH($(ColName),$(Values))'; //If WHERE clause does not exist then create it&lt;BR /&gt;ENDIF&lt;BR /&gt;ENDIF&lt;BR /&gt;END SUB;&lt;BR /&gt;&lt;BR /&gt;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////&lt;/P&gt;&lt;P&gt;//Here we set the variables ready to hold the names of any fields we want considering for ODAG filtering (selection)&lt;BR /&gt;//The ods_ field names bind the fields to those in your Selections Application.&lt;/P&gt;&lt;P&gt;SET Sel_Implementation = ; //resets the variable from any previous reload&lt;BR /&gt;SET Sel_Implementation = $(od_Implementation); // follow 'ods_' with the field name as it appears in your UI / final load&lt;BR /&gt;SET Sel_Implementation_COLNAME ='Implementation'; // enter the field name as it appears in the source data&lt;BR /&gt;&lt;BR /&gt;SET "Sel_Customer ID" = ;&lt;BR /&gt;SET "Sel_Customer ID"= $(od_Customer ID);&lt;BR /&gt;SET "Sel_Customer ID_COLNAME" ='Customer ID';&lt;BR /&gt;///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////&lt;BR /&gt;//This section builds the WHERE_PART variables that are passed to the SUB&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;SET WHERE_PART = '';&lt;BR /&gt;// WHERE_PART to be applied to only TIM loads that contain Suffix&lt;BR /&gt;FOR EACH fldname IN 'Sel_Implementation', 'Sel_Customer ID'&lt;BR /&gt;LET vallist = $(fldname);&lt;BR /&gt;WHEN (IsNull(vallist)) LET vallist = '';&lt;BR /&gt;IF len(vallist) &amp;gt; 0 THEN&lt;BR /&gt;CALL ExtendWhere('$(fldname)','$(vallist)');&lt;BR /&gt;ENDIF&lt;BR /&gt;NEXT fldname&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;TRACE Generated WHERE clause: ;&lt;BR /&gt;TRACE $(WHERE_PART);&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2020 12:45:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Handling-field-names-with-spaces-in-ODAG-script/m-p/1674372#M51158</guid>
      <dc:creator>brandk</dc:creator>
      <dc:date>2020-02-11T12:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: Handling field names with spaces in ODAG script</title>
      <link>https://community.qlik.com/t5/App-Development/Handling-field-names-with-spaces-in-ODAG-script/m-p/1674382#M51162</link>
      <description>&lt;P&gt;Can you see if this makes any difference (adding square brackets around the field name)&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;SET "Sel_Customer ID" = ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SET "Sel_Customer ID"= $(od_Customer ID);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SET "Sel_Customer ID_COLNAME" ='&lt;FONT size="5"&gt;&lt;STRONG&gt;[&lt;/STRONG&gt;&lt;/FONT&gt;Customer ID&lt;FONT size="5"&gt;&lt;STRONG&gt;]&lt;/STRONG&gt;&lt;/FONT&gt;';&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2020 12:59:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Handling-field-names-with-spaces-in-ODAG-script/m-p/1674382#M51162</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2020-02-11T12:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: Handling field names with spaces in ODAG script</title>
      <link>https://community.qlik.com/t5/App-Development/Handling-field-names-with-spaces-in-ODAG-script/m-p/1674398#M51169</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46628"&gt;@sunny_talwar&lt;/a&gt;&amp;nbsp; adding square brackets fixes the syntax error but I get an "UNexpected token" error when I try to generate an app&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2020 13:34:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Handling-field-names-with-spaces-in-ODAG-script/m-p/1674398#M51169</guid>
      <dc:creator>brandk</dc:creator>
      <dc:date>2020-02-11T13:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: Handling field names with spaces in ODAG script</title>
      <link>https://community.qlik.com/t5/App-Development/Handling-field-names-with-spaces-in-ODAG-script/m-p/1674406#M51171</link>
      <description>&lt;P&gt;Do you get a value for&amp;nbsp;&lt;SPAN&gt;TRACE $(WHERE_PART); in your reload progress while doing the load?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2020 13:51:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Handling-field-names-with-spaces-in-ODAG-script/m-p/1674406#M51171</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2020-02-11T13:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: Handling field names with spaces in ODAG script</title>
      <link>https://community.qlik.com/t5/App-Development/Handling-field-names-with-spaces-in-ODAG-script/m-p/1674409#M51173</link>
      <description>&lt;P&gt;No the load fails almost instantly with no other progress message. Please check attached image&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2020 13:57:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Handling-field-names-with-spaces-in-ODAG-script/m-p/1674409#M51173</guid>
      <dc:creator>brandk</dc:creator>
      <dc:date>2020-02-11T13:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: Handling field names with spaces in ODAG script</title>
      <link>https://community.qlik.com/t5/App-Development/Handling-field-names-with-spaces-in-ODAG-script/m-p/1674417#M51174</link>
      <description>&lt;P&gt;Okay, so I think I have done this in one my scripts&lt;/P&gt;&lt;P&gt;SUB ExtendWhere(Name, ValVarName)&lt;BR /&gt;LET T = Name &amp;amp; '_COLNAME';&lt;BR /&gt;LET ColName = $(T);&lt;BR /&gt;LET Values = $(ValVarName);&lt;BR /&gt;IF len(Values) &amp;gt; 0 THEN&lt;BR /&gt;IF len(WHERE_PART) &amp;gt; 0 THEN //If WHERE clause exists then extend it with further values&lt;BR /&gt;LET WHERE_PART = '$(WHERE_PART) AND MATCH(&lt;FONT size="5"&gt;&lt;STRONG&gt;[&lt;/STRONG&gt;&lt;/FONT&gt;$(ColName)&lt;FONT size="5"&gt;&lt;STRONG&gt;]&lt;/STRONG&gt;&lt;/FONT&gt;,$(Values))';&lt;BR /&gt;ELSE&lt;BR /&gt;LET WHERE_PART = ' WHERE MATCH(&lt;FONT size="5"&gt;&lt;STRONG&gt;[&lt;/STRONG&gt;&lt;/FONT&gt;$(ColName)&lt;FONT size="5"&gt;&lt;STRONG&gt;]&lt;/STRONG&gt;&lt;/FONT&gt;,$(Values))'; //If WHERE clause does not exist then create it&lt;BR /&gt;ENDIF&lt;BR /&gt;ENDIF&lt;BR /&gt;END SUB;&lt;/P&gt;&lt;P&gt;and change the previous back to how you had it initially (with no square brackets)&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;SET "Sel_Customer ID" = ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SET "Sel_Customer ID"= $(od_Customer ID);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SET "Sel_Customer ID_COLNAME" ='Customer ID';&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2020 14:08:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Handling-field-names-with-spaces-in-ODAG-script/m-p/1674417#M51174</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2020-02-11T14:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: Handling field names with spaces in ODAG script</title>
      <link>https://community.qlik.com/t5/App-Development/Handling-field-names-with-spaces-in-ODAG-script/m-p/1674430#M51175</link>
      <description>&lt;P&gt;Unfortunately that did not work. I also tried " " in place of the square brackets. Could you possibly send a section of your code where you applied this technique?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2020 14:36:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Handling-field-names-with-spaces-in-ODAG-script/m-p/1674430#M51175</guid>
      <dc:creator>brandk</dc:creator>
      <dc:date>2020-02-11T14:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: Handling field names with spaces in ODAG script</title>
      <link>https://community.qlik.com/t5/App-Development/Handling-field-names-with-spaces-in-ODAG-script/m-p/1674450#M51177</link>
      <description>&lt;P&gt;This is what I have (anonymized my field name)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SUB ExtendWhere(Name, ValVarName)
  LET T = Name &amp;amp; '_COLNAME';
  LET ColName = $(T);
  LET Values = $(ValVarName);
  IF len(Values) &amp;gt; 0 THEN
  	IF len(WHERE_PART) &amp;gt; 0 THEN
    	LET WHERE_PART = '$(WHERE_PART) and Match([$(ColName)], $(Values))';
    ELSE
    	LET WHERE_PART = 'Where Match([$(ColName)], $(Values))';
    ENDIF
  ENDIF
END SUB;&lt;/LI-CODE&gt;&lt;P&gt;and then this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SET PT = ;
SET PT = $(ods_P T);
SET PT_COLNAME = 'P T';&lt;/LI-CODE&gt;&lt;P&gt;and then this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;FOR EACH fldname IN 'PT'
  LET vallist = $(fldname);
  WHEN (IsNull(vallist)) LET vallist = '';
  IF len(vallist) &amp;gt; 0 THEN
    CALL ExtendWhere('$(fldname)','$(vallist)');
  ENDIF
NEXT fldname&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2020 15:11:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Handling-field-names-with-spaces-in-ODAG-script/m-p/1674450#M51177</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2020-02-11T15:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: Handling field names with spaces in ODAG script</title>
      <link>https://community.qlik.com/t5/App-Development/Handling-field-names-with-spaces-in-ODAG-script/m-p/1674661#M51201</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46628"&gt;@sunny_talwar&lt;/a&gt;&amp;nbsp; Thanks alot.That helped&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2020 07:21:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Handling-field-names-with-spaces-in-ODAG-script/m-p/1674661#M51201</guid>
      <dc:creator>brandk</dc:creator>
      <dc:date>2020-02-12T07:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: Handling field names with spaces in ODAG script</title>
      <link>https://community.qlik.com/t5/App-Development/Handling-field-names-with-spaces-in-ODAG-script/m-p/1674786#M51209</link>
      <description>&lt;P&gt;What exactly was the issue? What did you change?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2020 12:47:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Handling-field-names-with-spaces-in-ODAG-script/m-p/1674786#M51209</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2020-02-12T12:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: Handling field names with spaces in ODAG script</title>
      <link>https://community.qlik.com/t5/App-Development/Handling-field-names-with-spaces-in-ODAG-script/m-p/1674814#M51213</link>
      <description>&lt;P&gt;I made 2 changes to my original script. Firstly I added the square brackets as you suggested. Secondly I removed the&amp;nbsp; double quotes from the field names on the left hand side of the&amp;nbsp; SET command&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2020 13:15:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Handling-field-names-with-spaces-in-ODAG-script/m-p/1674814#M51213</guid>
      <dc:creator>brandk</dc:creator>
      <dc:date>2020-02-12T13:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: Handling field names with spaces in ODAG script</title>
      <link>https://community.qlik.com/t5/App-Development/Handling-field-names-with-spaces-in-ODAG-script/m-p/1674818#M51214</link>
      <description>&lt;P&gt;My final script has the changes made as highlighted&lt;/P&gt;&lt;P&gt;SUB ExtendWhere(Name, ValVarName)&lt;BR /&gt;LET T = Name &amp;amp; '_COLNAME';&lt;BR /&gt;LET ColName = $(T);&lt;BR /&gt;LET Values = $(ValVarName);&lt;BR /&gt;IF len(Values) &amp;gt; 0 THEN&lt;BR /&gt;IF len(WHERE_PART) &amp;gt; 0 THEN //If WHERE clause exists then extend it with further values&lt;BR /&gt;LET WHERE_PART = '$(WHERE_PART) AND MATCH&lt;FONT color="#00FF00"&gt;([$(ColName)]&lt;/FONT&gt;,$(Values))';&lt;BR /&gt;ELSE&lt;BR /&gt;LET WHERE_PART = ' WHERE MATCH(&lt;FONT color="#00FF00"&gt;[$(ColName)],&lt;/FONT&gt;$(Values))'; //If WHERE clause does not exist then create it&lt;BR /&gt;ENDIF&lt;BR /&gt;ENDIF&lt;BR /&gt;END SUB;&lt;BR /&gt;&lt;BR /&gt;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////&lt;/P&gt;&lt;P&gt;//Here we set the variables ready to hold the names of any fields we want considering for ODAG filtering (selection)&lt;BR /&gt;//The ods_ field names bind the fields to those in your Selections Application.&lt;/P&gt;&lt;P&gt;SET Sel_Implementation = ; //resets the variable from any previous reload&lt;BR /&gt;SET Sel_Implementation = $(od_Implementation); // follow 'ods_' with the field name as it appears in your UI / final load&lt;BR /&gt;SET Sel_Implementation_COLNAME ='Implementation'; // enter the field name as it appears in the source data&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;SET Sel_CustomerID = ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;SET Sel_CustomerID = $(od_Customer ID);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;SET Sel_CustomerID _COLNAME" ='Customer ID'&lt;/FONT&gt;;&lt;BR /&gt;///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////&lt;BR /&gt;//This section builds the WHERE_PART variables that are passed to the SUB&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;SET WHERE_PART = '';&lt;BR /&gt;// WHERE_PART to be applied to only TIM loads that contain Suffix&lt;BR /&gt;FOR EACH fldname IN 'Sel_Implementation', '&lt;FONT color="#00FF00"&gt;Sel_CustomerID'&lt;/FONT&gt;&lt;BR /&gt;LET vallist = $(fldname);&lt;BR /&gt;WHEN (IsNull(vallist)) LET vallist = '';&lt;BR /&gt;IF len(vallist) &amp;gt; 0 THEN&lt;BR /&gt;CALL ExtendWhere('$(fldname)','$(vallist)');&lt;BR /&gt;ENDIF&lt;BR /&gt;NEXT fldname&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;TRACE Generated WHERE clause: ;&lt;BR /&gt;TRACE $(WHERE_PART);&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2020 13:22:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Handling-field-names-with-spaces-in-ODAG-script/m-p/1674818#M51214</guid>
      <dc:creator>brandk</dc:creator>
      <dc:date>2020-02-12T13:22:15Z</dc:date>
    </item>
  </channel>
</rss>

