<?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: Subroutine to AutoNumberHash128 keys in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Subroutine-to-AutoNumberHash128-keys/m-p/1852236#M1215700</link>
    <description>&lt;P&gt;Hi Marco,&lt;/P&gt;
&lt;P&gt;1.&amp;nbsp;I've never said autonumber() didn't exists .. what I said is that the script funcion AUTONUMBER '%_*'; (for example to make autonumber all key fields starting with "%_") doesn't exist until 12.4 in QlikView.&lt;/P&gt;
&lt;P&gt;2.And what I'm trying to do, is to replicate that behaviour (AUTONOMBER '%_*') on a subroutine, but I don't know which is the best method for that ... because I need to read each table looking for a key field starting with 'a %_' .. which is easy with a loop, and then I have to autonumber() the field.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Oct 2021 06:29:17 GMT</pubDate>
    <dc:creator>axnvazquez</dc:creator>
    <dc:date>2021-10-27T06:29:17Z</dc:date>
    <item>
      <title>Subroutine to AutoNumberHash128 keys</title>
      <link>https://community.qlik.com/t5/QlikView/Subroutine-to-AutoNumberHash128-keys/m-p/1851728#M1215676</link>
      <description>&lt;P&gt;Hi everyone!&lt;/P&gt;
&lt;P&gt;I have a question, because I'm trying to re-adapt a subroutine that I found on QlikFix, which use the script function "AUTONUMBER", but it's only available for versions above 12.4, which I don't have ...&lt;/P&gt;
&lt;P&gt;So, it's possible to modify or create a subroutine that for every key on each table with a prefix like "_*" converts it to&amp;nbsp;AutoNumberHash128?&lt;/P&gt;
&lt;P&gt;I'm trying something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;FOR vT = 0 TO nooftables()-1

    LET vTable        =tablename(vT);

    Let vF            = 1;        // initialise variable for next loop
    
    Let Nvf 		= nooffields('$(vTable)');

    DO While vF &amp;lt;= Nvf

        LET vField=fieldname(vF,'$(vTable)');

        IF wildmatch('$(vField)','_Clave*') THEN

            Left join($(vTable))
            LOAD $(vField), AutoNumberHash128($(vField)) as %_$(vField) RESIDENT $(vTable);
            
            drop field $(vField);
            
            
        ENDIF

        Let vF = vF + 1;

    LOOP

NEXT&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But it's not working .. do you have any suggestions?&lt;/P&gt;
&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 08:41:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Subroutine-to-AutoNumberHash128-keys/m-p/1851728#M1215676</guid>
      <dc:creator>axnvazquez</dc:creator>
      <dc:date>2021-10-26T08:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: Subroutine to AutoNumberHash128 keys</title>
      <link>https://community.qlik.com/t5/QlikView/Subroutine-to-AutoNumberHash128-keys/m-p/1852088#M1215693</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;1. It's not true that AutoNumber() did not exist prior to v12.4&lt;/P&gt;
&lt;P&gt;2. Can you please post an example of what you have and what you expect?&lt;/P&gt;
&lt;P&gt;thanks&lt;/P&gt;
&lt;P&gt;Marco&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 19:15:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Subroutine-to-AutoNumberHash128-keys/m-p/1852088#M1215693</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2021-10-26T19:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: Subroutine to AutoNumberHash128 keys</title>
      <link>https://community.qlik.com/t5/QlikView/Subroutine-to-AutoNumberHash128-keys/m-p/1852236#M1215700</link>
      <description>&lt;P&gt;Hi Marco,&lt;/P&gt;
&lt;P&gt;1.&amp;nbsp;I've never said autonumber() didn't exists .. what I said is that the script funcion AUTONUMBER '%_*'; (for example to make autonumber all key fields starting with "%_") doesn't exist until 12.4 in QlikView.&lt;/P&gt;
&lt;P&gt;2.And what I'm trying to do, is to replicate that behaviour (AUTONOMBER '%_*') on a subroutine, but I don't know which is the best method for that ... because I need to read each table looking for a key field starting with 'a %_' .. which is easy with a loop, and then I have to autonumber() the field.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Oct 2021 06:29:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Subroutine-to-AutoNumberHash128-keys/m-p/1852236#M1215700</guid>
      <dc:creator>axnvazquez</dc:creator>
      <dc:date>2021-10-27T06:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: Subroutine to AutoNumberHash128 keys</title>
      <link>https://community.qlik.com/t5/QlikView/Subroutine-to-AutoNumberHash128-keys/m-p/1853200#M1215751</link>
      <description>&lt;P&gt;IMO the code-snippet looked quite suitable for your mentioned task. The document-log should give some valuable hints where it breaks. I could imagine that it breaks if you any special chars or spaces within your table/field-names because they need to be wrapped with [] or "" - just add it by each normal field/table-call but not by the reference within the table/field-functions because there the wrapping is ''.&lt;/P&gt;
&lt;P&gt;Beside this there is probably not much what could be improved on this approach. The join might be replaced by a mapping but I doubt that it would give a significantly difference. Within the the normal load-logics you couldn't avoid the resident-load because you could do any transforming only against the data-tables and not against the system-tables.&lt;/P&gt;
&lt;P&gt;An maybe more performant alternatively may be to use:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/qlikview/May2021/Subsystems/Client/Content/QV_QlikView/Scripting/ScriptRegularStatements/Map.htm" target="_blank"&gt;Map ‒ QlikView&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;which could replace the values from the system-tables. Means in your case to replace the join from the routine with a loop over the field-values and loading it into mapping table.&lt;/P&gt;
&lt;P&gt;Personally I wouldn't do something like this because for the most keys I don't need and want an autonumber() and if I would tend to create them within the origin load. Not each key must be an autonumber() especially not if those real-information are also needed which then usually leads to keep the origin field and having an autonumber(). Possible yes, really much benefit, hmmm ...&lt;/P&gt;
&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Thu, 28 Oct 2021 15:51:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Subroutine-to-AutoNumberHash128-keys/m-p/1853200#M1215751</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2021-10-28T15:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: Subroutine to AutoNumberHash128 keys</title>
      <link>https://community.qlik.com/t5/QlikView/Subroutine-to-AutoNumberHash128-keys/m-p/1853512#M1215768</link>
      <description>&lt;P&gt;Hi Marcus!&lt;/P&gt;
&lt;P&gt;Now thinking this with your POV makes more sense about taking control of what I'm going to autonumber(), like you said, it's a process to be self-conscious about the key definitions.&lt;/P&gt;
&lt;P&gt;Thank you so much for your response!&lt;/P&gt;</description>
      <pubDate>Fri, 29 Oct 2021 08:20:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Subroutine-to-AutoNumberHash128-keys/m-p/1853512#M1215768</guid>
      <dc:creator>axnvazquez</dc:creator>
      <dc:date>2021-10-29T08:20:05Z</dc:date>
    </item>
  </channel>
</rss>

