Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

dropdown language

Questions related to using nuBuilder Forte.
Post Reply
Timo
Posts: 217
Joined: Thu Mar 15, 2018 9:26 pm
Has thanked: 1 time

dropdown language

Unread post by Timo »

HI guys,

I use a select object to display month names in a select field and these must appear in the language of the user. How can I build the SQL statement so that by default the column mt_de is used, if French is set as language, the column mt_fr has to be displayed in the dropdown.

My months table
monthtable.JPG
If the user's language is French, this SQL has to be run:

Code: Select all

SELECT `mt_id`,`mt_fr` FROM `months_names`
In all other cases, this one.

Code: Select all

SELECT `mt_id`,`mt_de` FROM `months_names`
How to combine them?
You do not have the required permissions to view the files attached to this post.
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: dropdown language

Unread post by toms »

Hi,

Since there is no Hash Cookie like #USER_LANGUAGE# which would simplify the SQL statement, you can(/need to) use an SQL join to retrieve a user's language.

Code: Select all

SELECT mt_id, 
       CASE 
         WHEN zzzzsys_user_id IS NULL 
               OR IFNULL(sus_language, '') <> 'French' THEN mt_de 
         ELSE mt_fr 
       END AS month_name 
FROM   months_names 
       LEFT JOIN zzzzsys_user 
              ON zzzzsys_user.zzzzsys_user_id = '#USER_ID#' 
zzzzsys_user_id IS NULL is for the globeadmin, since there is no zzzzsys_user_id in the zzzzsys_user table.


Wish list: Add a #USER_LANGUAGE# Hash Cookie.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: dropdown language

Unread post by admin »

.
Post Reply