<?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: Compare field value with string in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767738#M719164</link>
    <description>&lt;P&gt;Thanks, but I don't think is feasible, as i have&amp;nbsp; a table with nearly 9600 records and length of string can achieve 50000 , so i think it gets stuck because is a lot of information to compare . Really appreciate your help though&lt;/P&gt;</description>
    <pubDate>Thu, 10 Dec 2020 19:48:37 GMT</pubDate>
    <dc:creator>Pestaninha</dc:creator>
    <dc:date>2020-12-10T19:48:37Z</dc:date>
    <item>
      <title>Compare field value with string</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767283#M719152</link>
      <description>&lt;P&gt;Hi, I have the table bellow and I need to count values of 'String'&amp;nbsp; that are &amp;lt;= 'Plan'. Function SubtringCount Count(String,Plan) doesn't work because will only count the Match&lt;/P&gt;&lt;P&gt;Is this possible in script?&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Doc&lt;/TD&gt;&lt;TD&gt;Doc It&lt;/TD&gt;&lt;TD&gt;String&lt;/TD&gt;&lt;TD&gt;Plan&lt;/TD&gt;&lt;TD&gt;SubStringCount(String,Plan)&lt;/TD&gt;&lt;TD&gt;Expected result&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;16&lt;/TD&gt;&lt;TD&gt;10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9&lt;/TD&gt;&lt;TD&gt;7.00000000000000&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;17&lt;/TD&gt;&lt;TD&gt;10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9&lt;/TD&gt;&lt;TD&gt;7.00000000000000&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9&lt;/TD&gt;&lt;TD&gt;8.00000000000000&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;11&lt;/TD&gt;&lt;TD&gt;10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9&lt;/TD&gt;&lt;TD&gt;8.00000000000000&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9&lt;/TD&gt;&lt;TD&gt;8.00000000000000&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;13&lt;/TD&gt;&lt;TD&gt;10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9&lt;/TD&gt;&lt;TD&gt;8.00000000000000&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;14&lt;/TD&gt;&lt;TD&gt;10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9&lt;/TD&gt;&lt;TD&gt;8.00000000000000&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9&lt;/TD&gt;&lt;TD&gt;8.00000000000000&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;TD&gt;18&lt;/TD&gt;&lt;TD&gt;10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9&lt;/TD&gt;&lt;TD&gt;9.00000000000000&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;11&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;19&lt;/TD&gt;&lt;TD&gt;10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9&lt;/TD&gt;&lt;TD&gt;9.00000000000000&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;11&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9&lt;/TD&gt;&lt;TD&gt;9.00000000000000&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;11&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;16&lt;/TD&gt;&lt;TD&gt;25&lt;/TD&gt;&lt;TD&gt;10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9&lt;/TD&gt;&lt;TD&gt;10.00000000000000&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;13&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;17&lt;/TD&gt;&lt;TD&gt;26&lt;/TD&gt;&lt;TD&gt;10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9&lt;/TD&gt;&lt;TD&gt;10.00000000000000&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;13&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;29&lt;/TD&gt;&lt;TD&gt;10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9&lt;/TD&gt;&lt;TD&gt;12.00000000000000&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;19&lt;/TD&gt;&lt;TD&gt;28&lt;/TD&gt;&lt;TD&gt;10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9&lt;/TD&gt;&lt;TD&gt;14.00000000000000&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;14&lt;/TD&gt;&lt;TD&gt;23&lt;/TD&gt;&lt;TD&gt;10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9&lt;/TD&gt;&lt;TD&gt;15.00000000000000&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;17&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;24&lt;/TD&gt;&lt;TD&gt;10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9&lt;/TD&gt;&lt;TD&gt;15.00000000000000&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;17&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;18&lt;/TD&gt;&lt;TD&gt;27&lt;/TD&gt;&lt;TD&gt;10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9&lt;/TD&gt;&lt;TD&gt;16.00000000000000&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;18&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;21&lt;/TD&gt;&lt;TD&gt;10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9&lt;/TD&gt;&lt;TD&gt;17.00000000000000&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;13&lt;/TD&gt;&lt;TD&gt;22&lt;/TD&gt;&lt;TD&gt;10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9&lt;/TD&gt;&lt;TD&gt;17.00000000000000&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 12:06:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767283#M719152</guid>
      <dc:creator>Pestaninha</dc:creator>
      <dc:date>2020-12-09T12:06:26Z</dc:date>
    </item>
    <item>
      <title>Re: Compare field value with string</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767300#M719153</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/74302"&gt;@Pestaninha&lt;/a&gt;&amp;nbsp; Maye be like :&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Data:

load *,if(Subfield(String,'-')&amp;lt;=Num(Plan),1,0) as SubTmp;
;
LOAD * INLINE [
    Doc, Doc It, String, Plan
    7, 16, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 7.00000000000000
    8, 17, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 7.00000000000000
    1, 10, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 8.00000000000000
    2, 11, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 8.00000000000000
    3, 12, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 8.00000000000000
    4, 13, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 8.00000000000000
    5, 14, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 8.00000000000000
    6, 15, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 8.00000000000000
    9, 18, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 9.00000000000000
    10, 19, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 9.00000000000000
    11, 20, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 9.00000000000000
    16, 25, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 10.00000000000000
    17, 26, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 10.00000000000000
    20, 29, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 12.00000000000000
    19, 28, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 14.00000000000000
    14, 23, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 15.00000000000000
    15, 24, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 15.00000000000000
    18, 27, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 16.00000000000000
    12, 21, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 17.00000000000000
    13, 22, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 17.00000000000000
];

output:
noconcatenate

load Doc, [Doc It], String, Plan resident Data;
left join load Doc, [Doc It],String, Sum(SubTmp) as  [Expected result] resident Data group by Doc, [Doc It], String;

drop table Data;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Taoufiq_Zarra_0-1607517856167.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/45437i069CD2F516537A11/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Taoufiq_Zarra_0-1607517856167.png" alt="Taoufiq_Zarra_0-1607517856167.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 12:44:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767300#M719153</guid>
      <dc:creator>Taoufiq_Zarra</dc:creator>
      <dc:date>2020-12-09T12:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: Compare field value with string</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767303#M719154</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 638px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/45438iF3E7CA4A30AD406A/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>Wed, 09 Dec 2020 12:44:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767303#M719154</guid>
      <dc:creator>Taoufiq_Zarra</dc:creator>
      <dc:date>2020-12-09T12:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: Compare field value with string</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767343#M719155</link>
      <description>&lt;P&gt;Thanks Taoufiq , the problem with this is that generates a record for every comparison that does against the sub field generating hundreds of thousands of lines.&amp;nbsp; Not feasible when you have big tables&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 14:26:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767343#M719155</guid>
      <dc:creator>Pestaninha</dc:creator>
      <dc:date>2020-12-09T14:26:06Z</dc:date>
    </item>
    <item>
      <title>Re: Compare field value with string</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767359#M719156</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/74302"&gt;@Pestaninha&lt;/a&gt;&amp;nbsp; and by adding distinct like :&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Data:

load *,if(Subfield(String,'-')&amp;lt;=Num(Plan),1,0) as SubTmp;
;
LOAD * INLINE [
    Doc, Doc It, String, Plan
    7, 16, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 7.00000000000000
    8, 17, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 7.00000000000000
    1, 10, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 8.00000000000000
    2, 11, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 8.00000000000000
    3, 12, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 8.00000000000000
    4, 13, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 8.00000000000000
    5, 14, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 8.00000000000000
    6, 15, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 8.00000000000000
    9, 18, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 9.00000000000000
    10, 19, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 9.00000000000000
    11, 20, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 9.00000000000000
    16, 25, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 10.00000000000000
    17, 26, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 10.00000000000000
    20, 29, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 12.00000000000000
    19, 28, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 14.00000000000000
    14, 23, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 15.00000000000000
    15, 24, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 15.00000000000000
    18, 27, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 16.00000000000000
    12, 21, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 17.00000000000000
    13, 22, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 17.00000000000000
];

output:
noconcatenate

load distinct  Doc, [Doc It], String, Plan resident Data;
left join load Doc, [Doc It],String, Sum(SubTmp) as  [Expected result] resident Data group by Doc, [Doc It], String;

drop table Data;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;output :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Taoufiq_Zarra_0-1607525905338.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/45459i3EC32C46A396F52B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Taoufiq_Zarra_0-1607525905338.png" alt="Taoufiq_Zarra_0-1607525905338.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 14:58:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767359#M719156</guid>
      <dc:creator>Taoufiq_Zarra</dc:creator>
      <dc:date>2020-12-09T14:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: Compare field value with string</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767362#M719157</link>
      <description>&lt;P&gt;I'm afraid not , for this example the first load generates 400 lines out of a 20 line table.&lt;/P&gt;&lt;P&gt;Many thanks anyway&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 15:03:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767362#M719157</guid>
      <dc:creator>Pestaninha</dc:creator>
      <dc:date>2020-12-09T15:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: Compare field value with string</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767387#M719158</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/74302"&gt;@Pestaninha&lt;/a&gt;&amp;nbsp; try below approach without increasing your input data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let vFormula1 =null();
let vFormula2 =null();
let vString_Field_Name = 'String'; // define name of the field which holds String value
let vCompare_Field_with_String ='Plan'; // define field name which you need to compare with String

Data:
LOAD Doc, 
     [Doc It], 
     SubStringCount(String,'-')+1 as Count,
     String, 
     Plan
FROM Table;

Max_Count:
LOAD max(Count) as Max_Count;
LOAD FieldValue('Count',RecNo()) as Count
AutoGenerate FieldValueCount('Count');

let vMax_Count = Peek('Max_Count',0,'Max_Count');

DROP Table Max_Count;

for i=1 to $(vMax_Count)

let vFormula1 = 'rangesum(';

let vFormula2 = '$(vFormula2)' &amp;amp; 'if(subfield($(vString_Field_Name),'&amp;amp;chr(39)&amp;amp;'-'&amp;amp;chr(39)&amp;amp;',$(i))&amp;lt;=$(vCompare_Field_with_String),1,0),';

NEXT 

let vFormula = '$(vFormula1)' &amp;amp; mid('$(vFormula2)',1,len('$(vFormula2)')-1) &amp;amp; ')';

Final:
LOAD *,
     $(vFormula) as Results
Resident Data;

DROP Table Data;

let vFormula = null();
let vFormula1 = null();
let vFormula2 = null();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kush_0-1607529281496.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/45465iEA5FCFD4F5E7CFAF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kush_0-1607529281496.png" alt="Kush_0-1607529281496.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 15:57:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767387#M719158</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-12-09T15:57:02Z</dc:date>
    </item>
    <item>
      <title>Re: Compare field value with string</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767483#M719159</link>
      <description>&lt;P&gt;how about this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;load  Doc, [Doc It], String, Plan, count(Field)
where Field &amp;lt;=Plan
group by Doc, [Doc It], String, Plan;
load *, subfield( String,'-', iterno()) as Field, Iterno() as Index
while iterno()&amp;lt;=20;
LOAD * INLINE [
    Doc, Doc It, String, Plan
    7, 16, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 7.00000000000000
    8, 17, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 7.00000000000000
    1, 10, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 8.00000000000000
    2, 11, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 8.00000000000000
    3, 12, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 8.00000000000000
    4, 13, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 8.00000000000000
    5, 14, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 8.00000000000000
    6, 15, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 8.00000000000000
    9, 18, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 9.00000000000000
    10, 19, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 9.00000000000000
    11, 20, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 9.00000000000000
    16, 25, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 10.00000000000000
    17, 26, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 10.00000000000000
    20, 29, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 12.00000000000000
    19, 28, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 14.00000000000000
    14, 23, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 15.00000000000000
    15, 24, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 15.00000000000000
    18, 27, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 16.00000000000000
    12, 21, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 17.00000000000000
    13, 22, 10-10-12-14-15-15-16-17-17-7-7-8-8-8-8-8-8-9-9-9, 17.00000000000000
];&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 21:10:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767483#M719159</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2020-12-09T21:10:49Z</dc:date>
    </item>
    <item>
      <title>Re: Compare field value with string</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767487#M719160</link>
      <description>&lt;P&gt;and since you are grouping by the original fields there is no increase in row count&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 21:46:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767487#M719160</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2020-12-09T21:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: Compare field value with string</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767633#M719161</link>
      <description>&lt;P&gt;Many Thanks Kush but I can't make this work it does not execute the Final table. Script simply stops before that&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 13:04:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767633#M719161</guid>
      <dc:creator>Pestaninha</dc:creator>
      <dc:date>2020-12-10T13:04:12Z</dc:date>
    </item>
    <item>
      <title>Re: Compare field value with string</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767671#M719162</link>
      <description>&lt;P&gt;Many Thanks Kush, but the scripts stops before the execution of the final table and nothing happens&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 15:28:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767671#M719162</guid>
      <dc:creator>Pestaninha</dc:creator>
      <dc:date>2020-12-10T15:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: Compare field value with string</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767674#M719163</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/74302"&gt;@Pestaninha&lt;/a&gt;&amp;nbsp; Not sure but if you can share your script I can help where is the issue.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 15:39:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767674#M719163</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-12-10T15:39:52Z</dc:date>
    </item>
    <item>
      <title>Re: Compare field value with string</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767738#M719164</link>
      <description>&lt;P&gt;Thanks, but I don't think is feasible, as i have&amp;nbsp; a table with nearly 9600 records and length of string can achieve 50000 , so i think it gets stuck because is a lot of information to compare . Really appreciate your help though&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 19:48:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767738#M719164</guid>
      <dc:creator>Pestaninha</dc:creator>
      <dc:date>2020-12-10T19:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: Compare field value with string</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767740#M719165</link>
      <description>&lt;P&gt;Thanks Edwin, but still gives an error&amp;nbsp; 'Out of memory' when running the script, I suppose is because is a lot of data to compare&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 19:50:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767740#M719165</guid>
      <dc:creator>Pestaninha</dc:creator>
      <dc:date>2020-12-10T19:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: Compare field value with string</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767755#M719166</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/74302"&gt;@Pestaninha&lt;/a&gt;&amp;nbsp; length of the string doesn't matter .. there must be you are missing something. You can share screenshot of your script .&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 22:26:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767755#M719166</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-12-10T22:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: Compare field value with string</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767765#M719167</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/74302"&gt;@Pestaninha&lt;/a&gt;&amp;nbsp; Try below. I removed if condition from formula&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let vFormula1 =null();
let vFormula2 =null();
let vString_Field_Name = 'String'; // define name of the field which holds String value
let vCompare_Field_with_String ='Plan'; // define field name which you need to compare with String

Data:
LOAD Doc, 
     [Doc It], 
     SubStringCount(String,'-')+1 as Count,
     String, 
     Plan
FROM
[https://community.qlik.com/t5/New-to-QlikView/Compare-field-value-with-string/td-p/1767283]
(html, utf8, UserAgent is 'Mozilla/5.0', embedded labels, table is @1);

Max_Count:
LOAD max(Count) as Max_Count;
LOAD FieldValue('Count',RecNo()) as Count
AutoGenerate FieldValueCount('Count');

let vMax_Count = Peek('Max_Count',0,'Max_Count');

DROP Table Max_Count;

for i=1 to $(vMax_Count)

let vFormula1 = 'rangesum(';

let vFormula2 = '$(vFormula2)' &amp;amp; 'subfield($(vString_Field_Name),'&amp;amp;chr(39)&amp;amp;'-'&amp;amp;chr(39)&amp;amp;',$(i))&amp;lt;=$(vCompare_Field_with_String),';

NEXT 

let vFormula = '$(vFormula1)' &amp;amp; mid('$(vFormula2)',1,len('$(vFormula2)')-1) &amp;amp; ') *-1';

Final:
LOAD *,
     $(vFormula) as Results
Resident Data;

DROP Table Data;

let vFormula = null();
let vFormula1 = null();
let vFormula2 = null();&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 11 Dec 2020 00:00:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767765#M719167</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-12-11T00:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: Compare field value with string</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767872#M719168</link>
      <description>&lt;P&gt;Wow it worked. I've tried for a shorter period and it worked, less lines and it worked.&lt;/P&gt;&lt;P&gt;Fantastic! Really happy. Thanks again have a good day&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2020 09:30:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-field-value-with-string/m-p/1767872#M719168</guid>
      <dc:creator>Pestaninha</dc:creator>
      <dc:date>2020-12-11T09:30:33Z</dc:date>
    </item>
  </channel>
</rss>

