Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN 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 ; 
Labels (4)
0 Replies