Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Capturing Environment variable and displaying the columns

Hi,

I have a business requirement where I need to capture the user environment variable i.e if the user is using english or japanese version of the operating system then display a particular column. For example for the english users I want to display column A,B,C and for japanese users I want to display columns A, B and F.

Please suggest the way to acheive it if anyone has experienced similar kind of situation earlier. If any other piece of information is required from my side on this please let me know.

Regards,

Kingshuk

1 Solution

Accepted Solutions
Not applicable
Author

It seems there may be a few ways to do it using VBScript. I don't think there is anything built in to QlikView.

First, you would use VBScript to detect the language and then write the value to a variable and use that variable to control your charts. This following subroutine will display the language in a message box. The language is identified by a number. You may want to test which numbers your users get when they run it (make sure the security in your module window is set to System Access/Allow System Access).

Sub Lang
Set dtmConvertedDate = CreateObject("WbemScripting.SWbemDateTime")
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" &
strComputer & "\root\cimv2")

Set colOperatingSystems = objWMIService.ExecQuery
("Select * from Win32_OperatingSystem")

For Each objOperatingSystem in colOperatingSystems
msgbox("OS Language: " & objOperatingSystem.OSLanguage)
Next
End Sub


You could rewrite the MsgBox line to store the value in a variable with:

ActiveDocument.Variables("vLang").SetContent objOperatingSystem.OSLanguage, true


Then in column C/F, make the expression: If(vLang=1033, C, F)

Where C is the expression for C and F is the expression for F.

This should show which code equals which language: http://www.science.co.il/Language/Locale-Codes.asp?s=decimal

View solution in original post

2 Replies
Not applicable
Author

It seems there may be a few ways to do it using VBScript. I don't think there is anything built in to QlikView.

First, you would use VBScript to detect the language and then write the value to a variable and use that variable to control your charts. This following subroutine will display the language in a message box. The language is identified by a number. You may want to test which numbers your users get when they run it (make sure the security in your module window is set to System Access/Allow System Access).

Sub Lang
Set dtmConvertedDate = CreateObject("WbemScripting.SWbemDateTime")
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" &
strComputer & "\root\cimv2")

Set colOperatingSystems = objWMIService.ExecQuery
("Select * from Win32_OperatingSystem")

For Each objOperatingSystem in colOperatingSystems
msgbox("OS Language: " & objOperatingSystem.OSLanguage)
Next
End Sub


You could rewrite the MsgBox line to store the value in a variable with:

ActiveDocument.Variables("vLang").SetContent objOperatingSystem.OSLanguage, true


Then in column C/F, make the expression: If(vLang=1033, C, F)

Where C is the expression for C and F is the expression for F.

This should show which code equals which language: http://www.science.co.il/Language/Locale-Codes.asp?s=decimal

Not applicable
Author

Hi Miller,

Thanks a ton, this worked as I expected, I had used implemented this also.

Regards,

Kingshuk