Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Stuck with only function

Hi guys wondering if you might be able to help me

I have a translation table in excel and im currently using the only function to get out the English and Swiss translations using this formula :

=Only({<Code=[Trans}>}{$=vLanguage]) .

Here's an example below of the excel source file

Code    English  Swiss

Trans1  Other   Anderes

Trans2  Test     skss

Trans 3 Hello dsksk

I've got it to work for headers but I was trying to create a table with one field so should look like :

Swiss

Anderas

skss

dsksk

Is it possible to do that and if so whats the easiest way ?

I've looked at inline tables but was wondering if there was an easier way which would have less changes if we needed to add a new country.

Thanks very much Sarah

4 Replies
evan_kurowski
Specialist
Specialist

Hello Sarah,


You could try switching to a "vertical" vs. "horizontal" table format ( meaning your table doesn't add columns or grow any wider based on adding 1... n languages)


Try a field structure like:

Code     | Language | Text

1     | English     | Hello

1     | French     | Bon Jour

2     | English      | Goodbye

2     | French      | Adieu


Then the Only() expressions can be set up like this throughout the UI:

=Only(  {<Code={1},Language={'$(=MaxString(Language))'}>} Text)


20140807_language_translation.png

Add a listbox or selection vector for the field [Language], then when the end-user selects a different entry, translation will occur.  I wrap the set-analysis with MaxString() in the event that there are no selections in the field [Language], that it will always evaluate to at least one, but you could probably adjust the "default language" logic to your needs.  (that way you are not locked in to using the AlwaysOneSelected feature.  A great feature, but tends to become detached when the data model is emptied, meaning you're unexpectedly having to reset it.  With the method above, it will still show a single translation even if multiple values in [Language] are possible).

evan_kurowski
Specialist
Specialist

Btw, I was just imagining a scenario in which someone was presenting an application to a multi-cultural assembly (Sales demo, or global meeting or something).

If you use the CONCAT() function in place of ONLY(), there would be no reason to limit translations to a single language, you could show multiple languages side by side and accommodate your entire audience. (Just remember to leave room for multiple entries to render).

20140807_language_translation_02.png

Not applicable
Author

Thanks Evan that really helps is it possible to do it in a way that the code doesn't show

Thanks


Sarah

evan_kurowski
Specialist
Specialist

Sure Sarah,

I'll attach the app so you have the example to work with.

20140807_language_translation_03.png