Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
thomas_wang
Creator
Creator

How to TAG all fields with $hidden?

Hi All,

Here I have a "DataPrepare.qvw" that will be binary load, and I want to tag all fields in this qvw with $hidden. I tried the scripts like below.

LET vC = Concat($Field, ',');

TAG Fields $(vC) With $hidden;

But the variable vC has no value. What else should I do?

Thanks!

7 Replies
raviityou
Partner - Creator
Partner - Creator

It's better you do it in .qvw with "_ "or "%" or , and add the SET  HidePrefix=',' ; or SET  HidePrefix='_' ; and qualify in start of the table so all table will have the same prefix.

thomas_wang
Creator
Creator
Author

This is a good idea at the beginning, but my DataPrepare.qvw has been built. The situation is that I need to refer to this established DataPrepare.qvw to the new report. If “HidePrefix” or "HideSuffix" supports wildcards and matches all fields, it may be perfect. \('_')/

raviityou
Partner - Creator
Partner - Creator

In this case you can load all tables into qvd from DataPrepare.qvw (using loop) and add one more layer .qvw and add prefix and use as binary load.

Step :

Create new ,qvw say DataPrepare1.qvw

1)     Load Binary.

2)     Store into .qvd (using loop)

3)     Drop all table after store and reload using prefix.


FOR vCount = 0 to NoOfTables()-1

     LET vTableName = TableName($(vCount));

     STORE $(vTableName) INTO $(vTableName).qvd (qvd);

NEXT vCount


thomas_wang
Creator
Creator
Author

The description is very clear. Thank you very much! However, these field names have undergone substantial changes, and my front end expressions may need to be modified again.

My approach is to enumerate all the columns (though very many, but I can export them from document properties) and apply TAG instructions.

sfbi
Creator
Creator

I needed the same and found this solution today. 

Get all tables and fields: https://community.qlik.com/t5/App-Development/Export-List-of-Fields-from-Script/td-p/11791 

//Iterate through the loaded tables

For t = 0 to NoOfTables() - 1

//Iterate through the fields of table

For f = 1 to NoOfFields(TableName($(t)))

Tables:

Load

TableName($(t)) as Table,

TableNumber(TableName($(t))) as TableNo,

NoOfRows(TableName($(t))) as TableRows,

FieldName($(f),TableName($(t))) as Field,

FieldNumber(FieldName($(f),TableName($(t))),TableName($(t))) as FieldNo

Autogenerate 1;

Next f

Next t;

//concat fields on new table
[FIELDS]:
LOAD Concat(Field,', ') AS ALLFIELDS Resident Tables;
//drop Tables
Drop Table Tables;

let vFields = Peek('ALLFIELDS',0,'FIELDS');


TAG $(vFields) WITH $hidden;

fabian3684386
Contributor III
Contributor III

Is there a way to add all fields as hidden except a list of some fields?

marcus_sommer

From the above example:

...
LOAD Concat(Field,', ') AS ALLFIELDS Resident Tables where match(Field, 'x', 'y', 'z') = 0;
...