Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Not applicable

How does the fieldvalue function work

Hello,

I'm a newbie to Qlikview and was looking for some help using the fieldvalue function.

I am trying to insert text from a specific loaded table cell into a text box on my qlikview document. I have seen examples where the fieldvalue function has been used to accomplish this, however I am not quite sure how to use it. I have created a variable that looks at the required table "=chr(39) & Language & chr(39)" where "Language" is the alias given to the column containing the text. But I don't quite understand how to pull through the desired references/text and I don't understand the element no variable in the fieldvalue function.

I would appreciate any help

Many Thanks

Qlikview newbie

1 Solution

Accepted Solutions
MVP
MVP

Re: How does the fieldvalue function work

// The structure of your language file should contain a column per language, where the column header contains the language ID or language name:

LOAD * INLINE [

English, German

Hello, Hallo

This is a test, Dies ist ein Test

];

// Then it is a advisable to create a separate table where the user can choose the language from, each value of field Language must match one the field names of your prev table:

Languages:

LOAD * INLINE [

Language

English

German

];

// Thats all it needs in the script.

In the front end, create a variable vLanguage in the variable overview:

=chr(39)&Language&chr(39)

Then create a list box form field Language, select one Language and enter properties - general tab an select option 'Always one value selected'

That's mostly it. For any text you need to translate, use an expression. For this example, create two text boxes:

=FieldValue($(vLanguage),1)

=FieldValue($(vLanguage),2)

The first text box will print out a welcome text, the second the test text, translated in the selected language.

See also attached (if you are not on PE).

Regards,

Stefan

8 Replies
Highlighted
MVP
MVP

How does the fieldvalue function work

You could do it similar to the e.g. finance controlling demo app on the QV demo site:

You need to create a table with your languages (INLINE table for demo, you could also load in form DB or an excel sheet:

LOAD * INLINE [

English, German

Hello, Hallo

This is a test, Dies ist ein Test

];

Then you need to select the language e.g. from a Input box, assigning your Language variable, like you posted above.

Then, for any text element in your charts, you use an expression instead of the literal:

=fieldvalue($(vLanguage),2)

where the 2 indicates the row you want to pick.

Caution: Since fieldvalue will use the index taken from the compressed columns of the internal data model, you need to take care that all column values are unique, but for a translation table, this should be no problem.

Above will return 'This is a test' if Language is English and 'Dies ist ein Test' if Language is German.

Hope this helps,

Stefan

Not applicable

How does the fieldvalue function work

Hi Stefan,

Thanks for your response. I'm still having issues.

Firstly, how do you create variables/aliases when you load using inline? - did I mention that I am a Qlikview newbie?

I'm not sure where I am going wrong exactly, I'll just write out a quick summary of my approach:

- created a vLanguage variable in the document settings tab "=chr(39) & Language & chr(39)

- Created an excel document with text in column A (A1 being the column header called 'Text', A2 & A3 containing the sample text)

- Load the excel file with the "text as Language" in the script

- Inserted a text box and put in the expression "=fieldvalue($(vLanguage),2)

But I get a null ("-") result in the text box.

Could you please advise on what am doing incorrectly.

Thanks

Newbie

MVP
MVP

Re: How does the fieldvalue function work

// The structure of your language file should contain a column per language, where the column header contains the language ID or language name:

LOAD * INLINE [

English, German

Hello, Hallo

This is a test, Dies ist ein Test

];

// Then it is a advisable to create a separate table where the user can choose the language from, each value of field Language must match one the field names of your prev table:

Languages:

LOAD * INLINE [

Language

English

German

];

// Thats all it needs in the script.

In the front end, create a variable vLanguage in the variable overview:

=chr(39)&Language&chr(39)

Then create a list box form field Language, select one Language and enter properties - general tab an select option 'Always one value selected'

That's mostly it. For any text you need to translate, use an expression. For this example, create two text boxes:

=FieldValue($(vLanguage),1)

=FieldValue($(vLanguage),2)

The first text box will print out a welcome text, the second the test text, translated in the selected language.

See also attached (if you are not on PE).

Regards,

Stefan

Not applicable

How does the fieldvalue function work

Got it!

Thanks alot Stefan

Not applicable

Re: How does the fieldvalue function work

Got it!

Thanks alot Stefan

sateeshkumar
Contributor

Re: How does the fieldvalue function work

I got this one, I need this translation in my application. But thing is that data in my database is in only one language. How to translate to different languages when i select the language. Pls help me to get ride of this problem.

vikasmahajan
Esteemed Contributor

Re: How does the fieldvalue function work

Very Good explanation

vikasmahajan
Esteemed Contributor

Re: How does the fieldvalue function work

how to bring values ?

This is a test, Dies ist ein Test


Vikas