How to select culture setting based on a variable

Stimulsoft Dashboards.WEB discussion
Post Reply
jlorue
Posts: 126
Joined: Thu Apr 15, 2021 6:33 pm

How to select culture setting based on a variable

Post by jlorue »

Hi,
Using the Globalization editor, I have defined 2 languages for a Dashboard: English and Spanish.
When showing the Dashboard, I need to select the languaje based on the value of a variable.
How can I do that?
Thanks
Max Shamanov
Posts: 786
Joined: Tue Sep 07, 2021 10:11 am

Re: How to select culture setting based on a variable

Post by Max Shamanov »

Hello,

We need some additional time to investigate the issue, we will let you know about the result.

Thank you.
Max Shamanov
Posts: 786
Joined: Tue Sep 07, 2021 10:11 am

Re: How to select culture setting based on a variable

Post by Max Shamanov »

Hello,

Please check the new "Report culture expressions" feature that was added in the new 2023.1.1 release:
https://www.stimulsoft.com/en/blog/news ... dashboards

Thank you.
jlorue
Posts: 126
Joined: Thu Apr 15, 2021 6:33 pm

Re: How to select culture setting based on a variable

Post by jlorue »

Hi Max,
Yes, I had already seen it.
The point is that I could not find where or how to set the expression to select the language (based on the value of a variable) in the Globalization section
Could you please guide me?
Thanks
Attachments
culture.png
culture.png (7.12 KiB) Viewed 9626 times
Max Shamanov
Posts: 786
Joined: Tue Sep 07, 2021 10:11 am

Re: How to select culture setting based on a variable

Post by Max Shamanov »

Hello,

In the Culture property, select Insert Expression.
Please check the attached image.

Thank you.
Attachments
Designer_QgKSLa6N2z.png
Designer_QgKSLa6N2z.png (22.73 KiB) Viewed 9606 times
jlorue
Posts: 126
Joined: Thu Apr 15, 2021 6:33 pm

Re: How to select culture setting based on a variable

Post by jlorue »

Thanks Max. But I still cannot figure out how to build the expression.

Ej:
if {var1} == 1 then it should select English
if {var1} == 2 then it should select Spanish
if {var3} == 3 then it should select Italian

How should I build the expression?

Thanks
Lech Kulikowski
Posts: 6237
Joined: Tue Mar 20, 2018 5:34 am

Re: How to select culture setting based on a variable

Post by Lech Kulikowski »

Hello,

You can use the following expression:
{Switch(var1 == 1, "En-us", var1 == 2, "Es-es", var1 == 3, "IT-it")}

Thank you.
jlorue
Posts: 126
Joined: Thu Apr 15, 2021 6:33 pm

Re: How to select culture setting based on a variable

Post by jlorue »

It work! thanks a lot Lech and merry Christmas!!
Lech Kulikowski
Posts: 6237
Joined: Tue Mar 20, 2018 5:34 am

Re: How to select culture setting based on a variable

Post by Lech Kulikowski »

Hello,

Merry Christmas and a Happy New Year. May your coming year be filled with magic and dreams!
Post Reply