<?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 Creating a loop within Script for parsing a substring in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Creating-a-loop-within-Script-for-parsing-a-substring/m-p/1903643#M74541</link>
    <description>&lt;P&gt;I have part of my load script below; the aim is to parse out part of a string (Contract Name) with a cleaned number (e.g. 10, 20, 30 etc.). As you can see, there's a few different combinations within the string itself (it's not in standardised format so the substring can appear anywhere). The numbers however go from 10 all the way up to 500+ (in increments of 10). Without obviously repeating the below over and over again per line, is there a way I can get it to loop a single line?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if(WildMatch("Contract Name",'*_0010_*','*_0010-*','*-0010_*','*-0010-*','*_10_*')&amp;gt;0,'10',&lt;BR /&gt;if(WildMatch("Contract Name",'*_0020_*','*_0020-*','*-0020_*','*-0020-*','*_20_*')&amp;gt;0,'20',&lt;BR /&gt;if(WildMatch("Contract Name",'*_0030_*','*_0030-*','*-0030_*','*-0030-*','*_30_*')&amp;gt;0,'30',&lt;BR /&gt;if(WildMatch("Contract Name",'*_0040_*','*_0040-*','*-0040_*','*-0040-*','*_40_*')&amp;gt;0,'40',&lt;BR /&gt;if(WildMatch("Contract Name",'*_0050_*','*_0050-*','*-0050_*','*-0050-*','*_50_*')&amp;gt;0,'50',&lt;BR /&gt;if(WildMatch("Contract Name",'*_0060_*','*_0060-*','*-0060_*','*-0060-*','*_60_*')&amp;gt;0,'60',&lt;BR /&gt;if(WildMatch("Contract Name",'*_0070_*','*_0070-*','*-0070_*','*-0070-*','*_70_*')&amp;gt;0,'70',&lt;BR /&gt;if(WildMatch("Contract Name",'*_0080_*','*_0080-*','*-0080_*','*-0080-*','*_80_*')&amp;gt;0,'80',&lt;BR /&gt;if(WildMatch("Contract Name",'*_0090_*','*_0090-*','*-0090_*','*-0090-*','*_90_*')&amp;gt;0,'90',&lt;BR /&gt;if(WildMatch("Contract Name",'*_00100_*','*_00100-*','*-00100_*','*-00100-*','*_100_*')&amp;gt;0,'100',&lt;BR /&gt;if(WildMatch("Contract Name",'*_00110_*','*_00110-*','*-00110_*','*-00110-*','*_110_*')&amp;gt;0,'110',&lt;BR /&gt;if(WildMatch("Contract Name",'*_00120_*','*_00120-*','*-00120_*','*-00120-*','*_120_*')&amp;gt;0,'120',&lt;BR /&gt;if(WildMatch("Contract Name",'*_00130_*','*_00130-*','*-00130_*','*-00130-*','*_130_*')&amp;gt;0,'130',&lt;BR /&gt;if(WildMatch("Contract Name",'*_00140_*','*_00140-*','*-00140_*','*-00140-*','*_140_*')&amp;gt;0,'140',&lt;BR /&gt;if(WildMatch("Contract Name",'*_00150_*','*_00150-*','*-00150_*','*-00150-*','*_150_*')&amp;gt;0,'150',&lt;BR /&gt;if(WildMatch("Contract Name",'*_00160_*','*_00160-*','*-00160_*','*-00160-*','*_160_*')&amp;gt;0,'160',&lt;BR /&gt;if(WildMatch("Contract Name",'*_00170_*','*_00170-*','*-00170_*','*-00170-*','*_170_*')&amp;gt;0,'170',&lt;BR /&gt;if(WildMatch("Contract Name",'*_00180_*','*_00180-*','*-00180_*','*-00180-*','*_180_*')&amp;gt;0,'180',&lt;BR /&gt;if(WildMatch("Contract Name",'*_00190_*','*_00190-*','*-00190_*','*-00190-*','*_190_*')&amp;gt;0,'190',&lt;BR /&gt;if(WildMatch("Contract Name",'*_00200_*','*_00200-*','*-00200_*','*-00200-*','*_200_*')&amp;gt;0,'200',&lt;BR /&gt;null()))))))))))))))))))))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 10 Mar 2022 15:34:44 GMT</pubDate>
    <dc:creator>RWilliams92</dc:creator>
    <dc:date>2022-03-10T15:34:44Z</dc:date>
    <item>
      <title>Creating a loop within Script for parsing a substring</title>
      <link>https://community.qlik.com/t5/App-Development/Creating-a-loop-within-Script-for-parsing-a-substring/m-p/1903643#M74541</link>
      <description>&lt;P&gt;I have part of my load script below; the aim is to parse out part of a string (Contract Name) with a cleaned number (e.g. 10, 20, 30 etc.). As you can see, there's a few different combinations within the string itself (it's not in standardised format so the substring can appear anywhere). The numbers however go from 10 all the way up to 500+ (in increments of 10). Without obviously repeating the below over and over again per line, is there a way I can get it to loop a single line?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if(WildMatch("Contract Name",'*_0010_*','*_0010-*','*-0010_*','*-0010-*','*_10_*')&amp;gt;0,'10',&lt;BR /&gt;if(WildMatch("Contract Name",'*_0020_*','*_0020-*','*-0020_*','*-0020-*','*_20_*')&amp;gt;0,'20',&lt;BR /&gt;if(WildMatch("Contract Name",'*_0030_*','*_0030-*','*-0030_*','*-0030-*','*_30_*')&amp;gt;0,'30',&lt;BR /&gt;if(WildMatch("Contract Name",'*_0040_*','*_0040-*','*-0040_*','*-0040-*','*_40_*')&amp;gt;0,'40',&lt;BR /&gt;if(WildMatch("Contract Name",'*_0050_*','*_0050-*','*-0050_*','*-0050-*','*_50_*')&amp;gt;0,'50',&lt;BR /&gt;if(WildMatch("Contract Name",'*_0060_*','*_0060-*','*-0060_*','*-0060-*','*_60_*')&amp;gt;0,'60',&lt;BR /&gt;if(WildMatch("Contract Name",'*_0070_*','*_0070-*','*-0070_*','*-0070-*','*_70_*')&amp;gt;0,'70',&lt;BR /&gt;if(WildMatch("Contract Name",'*_0080_*','*_0080-*','*-0080_*','*-0080-*','*_80_*')&amp;gt;0,'80',&lt;BR /&gt;if(WildMatch("Contract Name",'*_0090_*','*_0090-*','*-0090_*','*-0090-*','*_90_*')&amp;gt;0,'90',&lt;BR /&gt;if(WildMatch("Contract Name",'*_00100_*','*_00100-*','*-00100_*','*-00100-*','*_100_*')&amp;gt;0,'100',&lt;BR /&gt;if(WildMatch("Contract Name",'*_00110_*','*_00110-*','*-00110_*','*-00110-*','*_110_*')&amp;gt;0,'110',&lt;BR /&gt;if(WildMatch("Contract Name",'*_00120_*','*_00120-*','*-00120_*','*-00120-*','*_120_*')&amp;gt;0,'120',&lt;BR /&gt;if(WildMatch("Contract Name",'*_00130_*','*_00130-*','*-00130_*','*-00130-*','*_130_*')&amp;gt;0,'130',&lt;BR /&gt;if(WildMatch("Contract Name",'*_00140_*','*_00140-*','*-00140_*','*-00140-*','*_140_*')&amp;gt;0,'140',&lt;BR /&gt;if(WildMatch("Contract Name",'*_00150_*','*_00150-*','*-00150_*','*-00150-*','*_150_*')&amp;gt;0,'150',&lt;BR /&gt;if(WildMatch("Contract Name",'*_00160_*','*_00160-*','*-00160_*','*-00160-*','*_160_*')&amp;gt;0,'160',&lt;BR /&gt;if(WildMatch("Contract Name",'*_00170_*','*_00170-*','*-00170_*','*-00170-*','*_170_*')&amp;gt;0,'170',&lt;BR /&gt;if(WildMatch("Contract Name",'*_00180_*','*_00180-*','*-00180_*','*-00180-*','*_180_*')&amp;gt;0,'180',&lt;BR /&gt;if(WildMatch("Contract Name",'*_00190_*','*_00190-*','*-00190_*','*-00190-*','*_190_*')&amp;gt;0,'190',&lt;BR /&gt;if(WildMatch("Contract Name",'*_00200_*','*_00200-*','*-00200_*','*-00200-*','*_200_*')&amp;gt;0,'200',&lt;BR /&gt;null()))))))))))))))))))))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 10 Mar 2022 15:34:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Creating-a-loop-within-Script-for-parsing-a-substring/m-p/1903643#M74541</guid>
      <dc:creator>RWilliams92</dc:creator>
      <dc:date>2022-03-10T15:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a loop within Script for parsing a substring</title>
      <link>https://community.qlik.com/t5/App-Development/Creating-a-loop-within-Script-for-parsing-a-substring/m-p/1903917#M74559</link>
      <description>&lt;P&gt;Hey, maybe this:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;Contracts:
LOAD * INLINE [
Contract Name
AA_0010-1-XYZ
BB-0100_01
CC_0230_AA
DD-0020-BB_AA
EE_BB_1-0030_A-BB
];

temp_contract_list:
LOAD DISTINCT
"Contract Name",
SUBFIELD(SUBFIELD("Contract Name",'_'),'-') AS combination
RESIDENT Contracts;

temp_contract_list2:
LOAD
"Contract Name",
NUM(EVALUATE(combination)) AS combination_eval
RESIDENT temp_contract_list;

DROP TABLE temp_contract_list;

temp_comb:
LOAD
FIELDVALUE('combination_eval',RECNO()) AS combination_eval
AUTOGENERATE FIELDVALUECOUNT('combination_eval');

INNER JOIN (temp_contract_list2)
LOAD
combination_eval
RESIDENT temp_comb
WHERE combination_eval &amp;gt; 9;

DROP TABLE temp_comb;

LEFT JOIN (Contracts)
LOAD
"Contract Name",
MIN(combination_eval) AS Number
RESIDENT temp_contract_list2
GROUP BY "Contract Name";

DROP TABLE temp_contract_list2;&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 11 Mar 2022 07:51:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Creating-a-loop-within-Script-for-parsing-a-substring/m-p/1903917#M74559</guid>
      <dc:creator>RsQK</dc:creator>
      <dc:date>2022-03-11T07:51:23Z</dc:date>
    </item>
  </channel>
</rss>

