<?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: Verifing Digits with repeat in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Verifing-Digits-with-repeat/m-p/1800258#M64835</link>
    <description>&lt;P&gt;Hi, for some reason it fails when you use the same name as the field on LAYOUT table, try renaming it, like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;LAYOUT:
LOAD
    '0'&amp;amp; Instalacao AS ID_INSTALACAO,
    If(len("CPF/CNPJ")&amp;lt;11,Repeat(0, 11-Len("CPF/CNPJ"))&amp;amp;Text("CPF/CNPJ"),Text("CPF/CNPJ")) AS tmpCPF_CNPJ,
    Segmento
resident Data;

AUX_LAYOUT_CNPJ:
NoConcatenate
LOAD
DISTINCT
    ID_INSTALACAO,
    If(len(tmpCPF_CNPJ)&amp;lt;14,Repeat('0', 14-Len(tmpCPF_CNPJ))&amp;amp;Text(tmpCPF_CNPJ),Text(tmpCPF_CNPJ)) AS CPF_CNPJ,
    Segmento
RESIDENT LAYOUT
;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Btw, I think you don't need to check the If(), just&amp;nbsp;&lt;EM&gt;Repeat('0', 14-Len(tmpCPF_CNPJ))&amp;amp;Text(tmpCPF_CNPJ)&lt;/EM&gt; will return the same result.&lt;/P&gt;</description>
    <pubDate>Sat, 17 Apr 2021 08:07:35 GMT</pubDate>
    <dc:creator>rubenmarin</dc:creator>
    <dc:date>2021-04-17T08:07:35Z</dc:date>
    <item>
      <title>Verifing Digits with repeat</title>
      <link>https://community.qlik.com/t5/App-Development/Verifing-Digits-with-repeat/m-p/1800199#M64829</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I need to check&amp;nbsp; a field for that I&amp;nbsp; fill with&amp;nbsp; zeros until get length equal to 11 and make the first verification, and that works just fine, but after&amp;nbsp; that I need a second verification and I need to fill this fields until reach 14 digits and for some reason the same command doesn't work. I tried other transformations but with the same result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Ex.&lt;/P&gt;&lt;P&gt;Input&lt;/P&gt;&lt;P&gt;1234&lt;/P&gt;&lt;P&gt;Output/Next Input&lt;/P&gt;&lt;P&gt;00000001234&lt;/P&gt;&lt;P&gt;Next Output&lt;/P&gt;&lt;P&gt;00000000001234&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;LAYOUT:
LOAD
    '0'&amp;amp; Instalacao AS ID_INSTALACAO,
    If(len("CPF/CNPJ")&amp;lt;11,Repeat(0, 11-Len("CPF/CNPJ"))&amp;amp;Text("CPF/CNPJ"),Text("CPF/CNPJ")) AS CPF_CNPJ,
    Segmento
FROM [MyLocal.xlsx]
(ooxml, embedded labels, table is Plan1);

AUX_LAYOUT_CNPJ:
LOAD
DISTINCT
    ID_INSTALACAO,
    If(len(CPF_CNPJ)&amp;lt;14,Repeat(0, 14-Len(CPF_CNPJ))&amp;amp;Text(CPF_CNPJ),Text(CPF_CNPJ)) AS CPF_CNPJ,
    Segmento
RESIDENT LAYOUT

//Tried this just for test
NoConcatenate
LAYOUT1:
LOAD
    ID_INSTALACAO,
    Num(CPF_CNPJ) AS CPF_CNPJ,
    Segmento
Resident LAYOUT;
DROP TABLE LAYOUT;&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="eduardo_dimperio_0-1618595467634.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/53173i72EF052B483E49F9/image-size/large?v=v2&amp;amp;px=999" role="button" title="eduardo_dimperio_0-1618595467634.png" alt="eduardo_dimperio_0-1618595467634.png" /&gt;&lt;/span&gt;&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, 16 Apr 2021 17:53:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Verifing-Digits-with-repeat/m-p/1800199#M64829</guid>
      <dc:creator>eduardo_dimperio</dc:creator>
      <dc:date>2021-04-16T17:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: Verifing Digits with repeat</title>
      <link>https://community.qlik.com/t5/App-Development/Verifing-Digits-with-repeat/m-p/1800258#M64835</link>
      <description>&lt;P&gt;Hi, for some reason it fails when you use the same name as the field on LAYOUT table, try renaming it, like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;LAYOUT:
LOAD
    '0'&amp;amp; Instalacao AS ID_INSTALACAO,
    If(len("CPF/CNPJ")&amp;lt;11,Repeat(0, 11-Len("CPF/CNPJ"))&amp;amp;Text("CPF/CNPJ"),Text("CPF/CNPJ")) AS tmpCPF_CNPJ,
    Segmento
resident Data;

AUX_LAYOUT_CNPJ:
NoConcatenate
LOAD
DISTINCT
    ID_INSTALACAO,
    If(len(tmpCPF_CNPJ)&amp;lt;14,Repeat('0', 14-Len(tmpCPF_CNPJ))&amp;amp;Text(tmpCPF_CNPJ),Text(tmpCPF_CNPJ)) AS CPF_CNPJ,
    Segmento
RESIDENT LAYOUT
;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Btw, I think you don't need to check the If(), just&amp;nbsp;&lt;EM&gt;Repeat('0', 14-Len(tmpCPF_CNPJ))&amp;amp;Text(tmpCPF_CNPJ)&lt;/EM&gt; will return the same result.&lt;/P&gt;</description>
      <pubDate>Sat, 17 Apr 2021 08:07:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Verifing-Digits-with-repeat/m-p/1800258#M64835</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2021-04-17T08:07:35Z</dc:date>
    </item>
    <item>
      <title>Re: Verifing Digits with repeat</title>
      <link>https://community.qlik.com/t5/App-Development/Verifing-Digits-with-repeat/m-p/1800575#M64869</link>
      <description>&lt;P&gt;Hi Ruben,&lt;/P&gt;&lt;P&gt;That work, but why it happened?&lt;/P&gt;&lt;P&gt;Will be complicate&amp;nbsp; to change the field's name every time that we change something in that field. But thanks a lot for that solution.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 16:06:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Verifing-Digits-with-repeat/m-p/1800575#M64869</guid>
      <dc:creator>eduardo_dimperio</dc:creator>
      <dc:date>2021-04-19T16:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: Verifing Digits with repeat</title>
      <link>https://community.qlik.com/t5/App-Development/Verifing-Digits-with-repeat/m-p/1800773#M64894</link>
      <description>&lt;P&gt;Hi Eduardo, I don't know, the syntax was correct so I did some test and found that it worked changing field names, I think this is some kind of bug.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 06:36:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Verifing-Digits-with-repeat/m-p/1800773#M64894</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2021-04-20T06:36:17Z</dc:date>
    </item>
  </channel>
</rss>

