Multi Language Dashboard

De Qknow
Ir para: navegação, pesquisa

Introduction

Flags1.png

Multi Language Dashboards are useful especially to companies that has operations along world with people from different countries accessing data from any places. Instead of create a lot of dashboards, one for each country, only one QlikView document can be used to change labels, texts, legends, from user preferences. Using the same data structure is possible allow users to select what language is prefered. Therefore, your effort to share data information can be concentrated at one project, turning it more easily updated, changed and increased. When a Multi Language Dashboard is used, all data are the same and will not change along the user navigation. Only how user will interpret data will be changed from one language to other one, based on user selection.

First step to prepare your dashboard to multi languages, is save all texts that can be changed by user navigation in a flat file, database or INLINE table. This document will use a INLINE to show you how prepare a dashboard to do this. But, you can save all text where you want, as a either Excel or text file.

To teach you how to do that, just load sample data below and follow all steps in this document. Take a look that this INLINE table has three columns, an INDEX and a column for each language that it will allow user change texts based on language selection. So, to test this procedure, create a new QlikView or QlikSense document and use the following data sample.


Translations:
LOAD * Inline [
Index, English, Português
   1 , Customer, Cliente
   2 , City, Cidade
   3 , State, Estado
   4 , Country, País
   5 , Phone, Telefone
   6 , Mobile, Celular
   7 , Address, Endereço
   8 , Company, Empresa
   9 , Fax, Fax
   10, ZipCode, Cep];

Preparing the Script

After load a table where all texts in different languages are available, it's necessary configure new tables to support all text changes based on user selection. In this example, a dashboard will show texts in English or Portuguese. So, first step is create a variable to store the user preference. Below of language tables, enter the following code:

LET vLanguage = '=Minstring(#Language)';

More information about variables in QlikView can be found here. Minstring will get first ocurrence from #Language column. But, up to now, this column don't was loaded. That's why the script below will be need, changing the structure from INLINE table and creating a new column named Translation.

Language:
CROSSTABLE (Language, Translation) LOAD
   Index, 
   English, 
   Português
RESIDENT Translations;
Qknow translation01.PNG

If script is stopped here a new table will be something like picture at side. That means CROSSTABLE statement will change tables structure, where INDEX will be preserved but both Portuguese and English columns will be cross to rows, creating a new column as Language. Take a look this column is the same used above and it's saved in variable definition. INDEX column will be a specific number to establish a unique value for each text that can be changed.

Intention here isn't talk about CROSSTABLE, but only for information, this function is used to change columns to rows. It's something like UNPIVOT instruction from SQL Server 2012. Remember, the script will not be interrupted here. This is just to let you understand what is happing.

Now is necessary create a new field where user can choose his/her prefered language. After that, the cross table is not more necessary. So, DROP TABLE statement will unload this table from memory.

LanguageList:
LOAD Language As #Language
 RESIDENT Language
 WHERE Language > 0;

DROP TABLE Language;

Preparing the Dashboard

Flags2.png

To use multi language each Text element, including chart's title, chart's legends, and any other texts will be update with a new instruction. Remember, for each field on INLINE table there're texts in Portuguese and English. Not only field names can be used, any other text should be inserted in INLINE table. With this technique INDEX column will select correct text for each dashboard's places. The following instruction is a natural LOAD that will put in memory a customer table.

LOAD ClienteID, 
     NomeEmpresa, NomeContato, Endereco, Cidade, Estado, CodigoPostal, 
     Pais, Fone, Fax, DataCadastro, DataModificação
FROM [qknow_clientes_v1.0.xls] (biff, embedded labels, table is Clientes$);
Note:  Download qknow_clientes_v1.0.xls here.

Only for information, see the following translations table:

Flags3.png
  • NomeEmpresa = CompanyName
  • NomeContato = ContactName
  • Endereco = Address
  • Cidade = City
  • Estado = State
  • CodigoPostal = PostalCode
  • Pais = Country
  • Fone = Mobile
  • Fax = Fax
  • DataCadastro = InsertedDate
  • DataModificacao = UpdatedDate

After reload all steps with scripts above, its possible change any text based on user preferences. To that, use a code below any local where a text will be translated. This technique will use a Set Analysis to select a correct text and language. For example, INDEX = 2 in INLINE table means City or Cidade text, based on #Language field.

=Minstring({<Index = {2}>} [$(vLanguage)])

Qknow translation03.PNG

Qknow translation02.PNG

For each item enter a INDEX designed. Don't forget to show #Language field to user select a correct language. And, using Properties Windows for #Language List, from General tab select Always one Value Selected option. This means a language will be always active.


Note: Flags in this article is a tribute for all people from these countries, that we were able to identify IP 
      sources accessing this portal. Thank you all. Forgive us other countries not identified. 



More Posts


Envelope01.jpg
Need more? Mail Us!



Main Page