Filling a localized combobox through SQL
Last Post 02-12-2009 11:05 AM by Chad Nash. 2 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
Dieter VierenUser is Offline
wading in the water
wading in the water
Posts:15
Avatar

--
02-11-2009 11:36 PM

    There have been posts about filling a combobox with SQL using $(CurrentLanguage), but I just wanted to point out it can be very simple using the following SQL (if you don't want to create a table)

    SELECT CASE '$(CurrentLanguage)'
     WHEN 'nl-BE' THEN 'Nederlands1'
     WHEN 'de-DE' THEN 'Deutsch1'
     ELSE 'English2' END as QuestionOption,
     1 as QuestionValue
    UNION ALL
    SELECT CASE '$(CurrentLanguage)'
     WHEN 'nl-BE' THEN 'Nederlands2'
     WHEN 'de-DE' THEN 'Deutsch2'
     ELSE 'English2' END as QuestionOption, 
     2 as QuestionValue

    You can just add as many UNIONS as you like, though the query could get a bit long... . So I guess it's best used for small lists and when you don't want to create an extra table.

    ps: you could also use:

    ... CASE LEFT('$(CurrentLanguage)',2) WHEN 'nl' THEN ...

    pps: sorry if this has been posted before.

    Dieter VierenUser is Offline
    wading in the water
    wading in the water
    Posts:15
    Avatar

    --
    02-12-2009 05:59 AM

    There seems to be a small issue with this method, I don't get any values when looking in the combobox html:

    (Nederlands1)

    (Nederlands2)

    ...

    Maybe it's something small I'm overlooking...

     

    edit: I found it: it had to be "QuestionOptionValue" instead of "QuestionValue" in the query above... sorry :/

    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    02-12-2009 11:05 AM
    Hi. Thanks for the follow up!

    -Chad


    ---
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi