Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Is it possible to translate the content of your database?

I am able to translate text when I indicate the actual Value, like f.e:

Only({<English={   Arrival    }>} [$(=vDataLanguage)])

Whet I cannot get to work is when the content of the database is Arrival.

I tried this:

=Only({<English={  [Event Type]  }>}   [$(=vDataLanguage)])

Where the [Event Type] database field has the content "Arrival".

Is it possible what I am trying to do?

Thanks in advance.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Hi Erik,

I also got this working as calculated dimension:

=FieldValue('$(vDataLanguage)',FieldIndex('English',[Event Type]))

Here you need to assure that your field values in your translation table are distinct, otherwise the lookup will probably deliver incorrect results. I think this should be the case for your translation table.

I also assumed (with both approaches) that your translation table is a data island, is this correct?

View solution in original post

12 Replies
swuehl
MVP
MVP

Without trying myself, but the assignment of a field to another in a set expression should work, but like

=Only({<English= [Event Type]  >}   [$(=vDataLanguage)])

(remove the element list curly brackets)

But then [Event Type] should be already limited to one possible value, right?

Not applicable
Author

When I change it, it shows an error:

// Error in calculated dimension

I am not sure what you mean with:

"But then [Event Type] should be already limited to one possible value, right?"

In my Event Type example, the values in the database are f.e. Departure, Arrival, Delivered and each have a translation to dutch, being Vetrek, Aankomst and Afgeleverd.

swuehl
MVP
MVP

Could you explain a little bit how your data model looks alike?

Do you have a table with field Event and other fields, one for each language supported (like field named Dutch)?

How do you handle translation of other fields than Event?

Anyway, I don't think that you could use a set expression like above within a calculated dimension, to be sensitive to dimension's value.

If you would have only field Event and its translation in a table, I think you could just use =[$(vDataLanguage)] as dimension, so your variable will determine the field used.

But I am more or less guessing, so your explanation or a small sample app showing your data model setting would be helpful.

Regards,

Stefan

Not applicable
Author

I have a table called Transactions, where one of the fields is called [Event Type] in English.

This is f.e. Departure, Arrival or Delivered.

some rows could look f.e.

order        date             Event Type

1234        20/11/2011    Departure

1234        21/11/2011    Arrival

2345        20/11/2011    Departure.

I have one table with translations, which looks like:

English          Dutch              Swedish

Departure       Vertrek            furtokke

Arrival            Aankomst       ankumst

Delivered        Afgeleverd       deluvered

I also have a variable, which will be set to English, Dutch or Swedish.

So when the flag is set to Dutch, I do not want to see the English word, but dutch.

So it would look like:

order        date             Event Type

1234        20/11/2011    Vertrek

1234        21/11/2011    Aankomst

2345        20/11/2011    Vertrek.

Not applicable
Author

I now have it working in a text box with this:

Only(    {  <English={   [$(=[Event Type])]    }  >  }     [$(=vDataLanguage)]    )

But it still gives the error in the bar chart.

swuehl
MVP
MVP

stormy66,

Only(    {  <English={   [$(=[Event Type])]    }  >  }     [$(=vDataLanguage)]    )

only works if you have one Event Type value selected, right?

As said, I don't think that you can use a set expression like this in a calculated dimension. But maybe like attached?

This is probably not very good performing on large data sets, but for a few dimension values it might be good enough.

Maybe I missed a much more simple solution, though.

Regards,

Stefan

Not applicable
Author

Swuehl,

First thanks a lot for you help so far.

It only show in a text box if I select 1. It does not work in a chart.

I still use the personal edition of qlikview and cannot open your qvw document anymore.

(Still waiting for my company to make a decision)

Can you explain what is in it?

Again thanks.

swuehl
MVP
MVP

Sure,

I used you sample data from above and a variable called vLanguage.

Then I created a chart with three dimensions, order, date and

=aggr(NODISTINCT if(English=[Event Type],$(vLanguage),NULL()),[Event Type],English)

as expression I think you could use anything from constant 1 to count(order).

Regards,

Stefan

Not applicable
Author

Stefan,

I do not know much about aggr function and when I try this is does not show anything.

Can you explain it a bit?

I have tried to change some of the parameters and here some results:

=aggr(NODISTINCT if(English=[Event Type],$(vDataLanguage),[Event Type]),[Event Type],English)

Will show just the english text. It does not matter which language I chose.

=aggr(NODISTINCT if(English=[Event Type],$(vDataLanguage),[Event Type]),[Event Type],$(vDataLanguage))

Shows me Enlish is I chose english. Does not show f.e. Sweden (I have no translation for it at the moment). When I chose Dutch, (which I have a translation for), it show me the English one.

Again, I really appriciate your help!

Erik