Hello there!
I got stuck with a challenge I hope you guys have an idea on how to accomplish.
It’s for an app where we offer the user to choose a preferred language. Based on the selected language, all content should be translated, including EnumList values.
Translation already works for column names etc using a large ‘Translations’ table and a corresponding expression for ‘Display Name’
The problem I face is around offering the user a drop down field (EnumList) that is
The current situation:
Table “Users” holding all information about the registered app users:
note: there is only one row per user
Users[Language]
as TextUsers[MyItems]
as EnumListTable “Contacts” holding information for each Item.
note: table contains multiple rows per ItemID
Contacts[ItemID]
as TextTable “Translations”:
What I want to achieve:
Goal 1: Create a virtual column that translates the Contacts[Contact_Role] into the users language.
I’m using this formula to translate a column name into the users language which works flawlessly:
ANY(SELECT(Translations[COLUMN_NAME],([Language] = LOOKUP(USEREMAIL(),Users,"Email","Language"))))
Because for the situation at hand, COLUMN_NAME actually refers to an Enum value from Contacts[Contact_Role], I thought I could replace Translations[COLUMN_NAME]
with a SWITCH statement that switches the columns based on the Contact_Role in the SELECT statement above, similar to Steve’s solution to this question
ANY(SELECT(
SWITCH([Contact_Role],
"Plant Manager", Translations[PlantManager],
"Maintenance", Translations[MaintenanceManager],
"Supervisor Plant Manager", Translations[SupervisorPlantManager],
Translations[No_Contact_Role]
),
([Language] = LOOKUP(USEREMAIL(),Users,"Email","Language"))
))
But this results in an error saying “Unable to find column ‘Language’”.
When replacing [Language] with Translations[Language], it results in the following error:
Cannot compare List with Enum in (Translations[Language] = ANY(SELECT(Users[Language],([Email] = USEREMAIL()))))
What am I missing here? Any guidance, ideas or hints are highly appreciated!
Goal 2: Concatenate the virtual column with other information.
Once goal 1 is achieved, I guess it should be easy using CONCATENATE() formula to add other info, either directly in the expression of the virtual column from goal 1 or as a new virtual column à la CONCATENATE([Goal1VirtualColumn],[otherColumnsOrText])
Solved! Go to Solution.
Hi Steve, I went for your suggestion with the virtual column holding the calculated translated value based on the user’s language. It works very well. Thank you very much!!
When using a prefix in the term to identify the field, it is even easy to have only one ENUM translation table that holds the translations of all ENUMs for all the different fields.
Example:
‘Term’ column enum values for [Field1] are:
Field1_Enum1 , Field1_Enum2 , Field1_Enum3
Using this expression to suggest all translated ENUMS that include the string “Field1”:
SELECT
(Enums[Translation],
(FIND(“Field1”, [Enum]) > 0),
FALSE
)
User | Count |
---|---|
17 | |
16 | |
4 | |
3 | |
2 |