Qlik Community

Qlik Design Blog

All about product and Qlik solutions: scripting, data modeling, visual design, extensions, best practices, etc.

Employee
Employee

Did you know that you can hide fields in your data model from appearing in a field list?  Similar to how we have the ability to show and hide system fields, we can also show and hide fields that we create in the script.  When the Show System Fields checkbox is checked, system fields and all fields created in the script are listed.  When the Show System Fields is not checked, the system fields and any fields hidden using HidePrefix or HideSuffix will not be displayed in the list.

system fields.png

It is very easy to do.  In the script, you set the user defined variable HidePrefix to the text that will prefix fields that you would like to hide.  In the Call Detail Record Analysis demo, I created a sheet that acted as a report giving the user the ability to select the dimensions and measures they wanted to see in the table.

report.png

To create the list of dimensions and measures that I wanted to make available to the user, I created two new fields: _dimension and _metrics.  You can find details on how to create a customizable report in this blog.  These fields are used solely on the report sheet to display the dimensions and measures so I decided to hide them so that they did not clutter up my field list.  To do this, I set the HidePrefix variable in my script.

SET HidePrefix = '_';

This means that any field that starts with the underscore (_) character will be hidden from the field list.  I then created my new fields with the underscore prefix.

Dimensions:
LOAD * INLINE [_dimension
Call Date
Calling Number
Called Number
Cell Towers Visited
IMSI
Direction
First Cell Tower
Last Cell Tower
Manufacturer
Phone Type
Reason for Drop
Week
]
;

Metrics:
LOAD * INLINE [_metricsNo, _metrics
1, Calls
2, Distinct Cell Towers
3, Dropped Call
4, Handovers
5, Setup Time
6, Talk Time
]
;

So now when I view the field list with the Show System Field checkbox unchecked, I cannot see the fields I created using the underscore character in the Available Fields list.

field list2.png

This keeps the available fields list shorter and removes fields that I know the user will not need to use anywhere else in the application.  Users also have the ability to use HideSuffix as well which does the same thing as HidePrefix except this looks at the ending of the field name for the text that is set in the HideSuffix variable.  HidePrefix is an easy way to keep the field list in your application clean and hides fields that you may not want the user to use or that you may want to hide to eliminate confusion.

Thanks,

Jennell

25 Comments
Partner
Partner

I also like TAG FIELDS ... WITH $hidden;

Then I don't have to use a prefix - now wouldn't it be great if Qlik Sense picked up this metadata.

3,164 Views
Specialist
Specialist

Hi Jennel.

Thanks for the post.

0 Likes
3,164 Views
Champion
Champion

Really cool.

We were using this at a time to direct a macro that would, when an app was opened via doc_chaining from a management_dashboard using a specific button, open a specific sheet.

We came away from that in the meantime, but we might use it again as we might start rolling out the Client_software as a means of opening QlikView to all machines - that would get us rid of display_problems rgd. the browser_view.

Thanks for the great post!

0 Likes
3,164 Views
Creator II
Creator II

Good to know Thanks a lot !

0 Likes
3,164 Views

It also hides the field from the Current Selections object which I have found really useful.

3,164 Views
Not applicable

This is very good post. We are using the HidePrefix all the autonumber generated keys

0 Likes
3,164 Views