<?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: SUB routine apparently not working to make prefixes on table dimensions (like qualify) in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/SUB-routine-apparently-not-working-to-make-prefixes-on-table/m-p/2534461#M108371</link>
    <description>&lt;P&gt;Hello Marcus,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the response, I use this SUB function so I don´t have to use qualify * and unqualify* everwhere, because there are hundreds of calls to this API REST, so to try to optimize the script, I thought about this.&lt;/P&gt;&lt;P&gt;Also, because there are so many calls, a lot of the times the dimensions come with the same names, so I want to qualify* with the name of the table, bc it´s the only way i can see diferentieting the dimensions.&lt;/P&gt;&lt;P&gt;Any tips?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Mon, 27 Oct 2025 12:11:52 GMT</pubDate>
    <dc:creator>Diego_780</dc:creator>
    <dc:date>2025-10-27T12:11:52Z</dc:date>
    <item>
      <title>SUB routine apparently not working to make prefixes on table dimensions (like qualify)</title>
      <link>https://community.qlik.com/t5/App-Development/SUB-routine-apparently-not-working-to-make-prefixes-on-table/m-p/2534051#M108314</link>
      <description>&lt;P&gt;Hello qlik pros!&lt;/P&gt;&lt;P&gt;I need some help because i don´t understand how it works what i have.&lt;/P&gt;&lt;P&gt;Apparently, I have a Subroutine that takes the table name, makes a prefix and puts it to each dimension of that table and renames it (basically a qualify):&lt;/P&gt;&lt;LI-CODE lang="c"&gt;SUB PrefixFields(vTableName)
    LET vNumFields = NoOfFields('$(vTableName)');
    FOR i = 1 TO $(vNumFields)
        LET vField = FieldName($(i), '$(vTableName)');
        // Evitamos campos técnicos o ya renombrados
        IF Left('$(vField)', 2) &amp;lt;&amp;gt; '__' AND Index('$(vField)', '$(vTableName).') = 0 THEN
            LET vNewField = '$(vTableName)-' &amp;amp; '$(vField)';
            RENAME FIELD [$(vField)] TO [$(vNewField)];
            LET vField2 = FieldName($(i), '$(vTableName)');
        ENDIF
    NEXT i
END SUB

LET vURL = '"http://ws.visualnacert.com/vnwebservices/user/$(vUserid)/v3/persontypes"';

RestConnectorMasterTable:
SQL SELECT 
    "__KEY_root",
    (SELECT 
        "id",
        "value",
        "__FK_data"
     FROM "data" FK "__FK_data")
FROM JSON (wrap on) "root" PK "__KEY_root"
WITH CONNECTION ( URL $(vURL));

[PersonTypes_data]:
LOAD    
    [id],
    [value]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_data]);
DROP TABLE RestConnectorMasterTable;

CALL PrefixFields('PersonTypes_data');
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When i go to see the visor, i see it perfectly, for now, i have 3 tables and they do what its said to be programmed:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Diego_780_0-1761122217112.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/184378i20B5FE6F5BC5BAE0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Diego_780_0-1761122217112.png" alt="Diego_780_0-1761122217112.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But when i try to store them into qvds with this script, it doesnt store with that prefix, and instead, stores the original names (id, desc):&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;For i = 0 to NoOfTables()-1
    LET vTabName = TableName(0);
    STORE [$(vTabName)] INTO [$(vRutaQVD_VISUAL)$(vTabName).qvd] (qvd);
    DROP TABLE [$(vTabName)];
Next i&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How is that possible or what am I doing wrong exactly? If i see that the SUB and CALL apparently makes the job done.&lt;/P&gt;&lt;P&gt;Thanks in regards,&lt;/P&gt;&lt;P&gt;Diego.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Oct 2025 08:39:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/SUB-routine-apparently-not-working-to-make-prefixes-on-table/m-p/2534051#M108314</guid>
      <dc:creator>Diego_780</dc:creator>
      <dc:date>2025-10-22T08:39:22Z</dc:date>
    </item>
    <item>
      <title>Re: SUB routine apparently not working to make prefixes on table dimensions (like qualify)</title>
      <link>https://community.qlik.com/t5/App-Development/SUB-routine-apparently-not-working-to-make-prefixes-on-table/m-p/2534074#M108321</link>
      <description>&lt;P&gt;You may not look on the wanted qvd else on elder (temporary) ones because the store-routine used tablename(0) instead of tablename($(i)). Further if I remember correctly needs this kind of loop-iteration to be reversed if it contains a drop-logic - means something like:&lt;/P&gt;&lt;P&gt;for i = nooftables()-1 to 0 step -1&lt;/P&gt;&lt;P&gt;To check this kind of logic you could comment the store + drop and adding a trace-statement like:&lt;/P&gt;&lt;P&gt;trace $(i) - $(TabName);&lt;/P&gt;&lt;P&gt;Further I could imagine that you may get the above described results with the qualifying-statements, maybe like:&lt;/P&gt;&lt;P&gt;qualify *;&lt;BR /&gt;unqualify __*;&lt;/P&gt;&lt;P&gt;load ...;&lt;BR /&gt;store ...;&lt;/P&gt;&lt;P&gt;unqualify *;&lt;/P&gt;&lt;P&gt;Beside this I suggest to rethink the entire approach because this qualifying caused later a lot of efforts to remove it again or leading to complex and unsuitable data-models. A BI data-model should be de-normalized as much as possible. If a tracking/differentiating of the data is needed this information could be added as an extra source-field within the table.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Oct 2025 12:15:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/SUB-routine-apparently-not-working-to-make-prefixes-on-table/m-p/2534074#M108321</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2025-10-22T12:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: SUB routine apparently not working to make prefixes on table dimensions (like qualify)</title>
      <link>https://community.qlik.com/t5/App-Development/SUB-routine-apparently-not-working-to-make-prefixes-on-table/m-p/2534461#M108371</link>
      <description>&lt;P&gt;Hello Marcus,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the response, I use this SUB function so I don´t have to use qualify * and unqualify* everwhere, because there are hundreds of calls to this API REST, so to try to optimize the script, I thought about this.&lt;/P&gt;&lt;P&gt;Also, because there are so many calls, a lot of the times the dimensions come with the same names, so I want to qualify* with the name of the table, bc it´s the only way i can see diferentieting the dimensions.&lt;/P&gt;&lt;P&gt;Any tips?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Oct 2025 12:11:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/SUB-routine-apparently-not-working-to-make-prefixes-on-table/m-p/2534461#M108371</guid>
      <dc:creator>Diego_780</dc:creator>
      <dc:date>2025-10-27T12:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: SUB routine apparently not working to make prefixes on table dimensions (like qualify)</title>
      <link>https://community.qlik.com/t5/App-Development/SUB-routine-apparently-not-working-to-make-prefixes-on-table/m-p/2534464#M108373</link>
      <description>&lt;P&gt;It's very common that many tables share various equally and/or similar fields, like dates, names, amounts ... But this doesn't mean that they couldn't be differentiated without a qualifying because their source-table defines the content - and just by adding the table-name as an extra field will in general&amp;nbsp;be sufficient.&amp;nbsp;&lt;/P&gt;&lt;P&gt;A BI data-model shouldn't contain hundreds of separate tables else they should be merged as much as possible in the direction of a star-scheme with a single fact-table and n dimension-tables. This means n concatenate + join measurements will be performed to get such result and it may end in tables like:&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Type&lt;/TD&gt;&lt;TD&gt;Amount&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2025/10/17&lt;/TD&gt;&lt;TD&gt;Order&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2025/10/18&lt;/TD&gt;&lt;TD&gt;Billing&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2025/10/19&lt;/TD&gt;&lt;TD&gt;Shipment&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;Approaches to keep such facts within n fact-tables and/or using n date-fields (Orderdate, Billingdate, Shipmentdate) for it are of course possible but will cause more complexity + much more efforts (development + maintaining) and usually a slower performance and disadvantages within the usability.&lt;/P&gt;&lt;P&gt;Therefore don't qualify your fields.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Oct 2025 12:50:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/SUB-routine-apparently-not-working-to-make-prefixes-on-table/m-p/2534464#M108373</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2025-10-27T12:50:49Z</dc:date>
    </item>
  </channel>
</rss>

