Qlik Community

Ask a Question

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
April 22, 2PM EST: Learn about GeoOperations in Qlik Sense SaaS READ MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
dvickers
Contributor III
Contributor III

How to Rename & Hide All Fields in Qlik Sense App

Here is a simple and effective way to rename all fields in the data model, then hide them to front end users using HidePrefix setting. 

 

// Test table 1
Table1: 
load * inline [
CompanyID, MarketName
Company1, California
Company2, North Carolina
Company3, Florida
];


// Test Table 2 
Table2: 
load * inline [
PersonID, PersonName
1, John
2, MadDog
3, Dave
];


// Get list of table names 
for t = 0 to NoOfTables()-1
    Tables:
    load tablename($(t)) as table AutoGenerate(1); 
    let tablename = peek('table',$(t),'Tables'); 

        // Now get list of each field name within each table
        for i = 1 to NoOfFields('$(tablename)')
        FieldNames: 
        mapping load FieldName($(i),'$(tablename)') as OldFieldName,
        'Hide.'&FieldName($(i),'$(tablename)') as NewFieldName
         AutoGenerate (1); 
        next i; // next field 
next t; // next table

// Rename these field names now
Rename Fields using FieldNames;

// Clean up unwanted table 
drop tables Tables;

// Decide whether to hide all fields
let hide = 1; 
if $(hide) =1 then 
    // hide all these fields now 
    Set HidePrefix = 'Hide'; 
end if ; 
0 Replies