Qlik Community

QlikView Management

Discussion Board for collaboration on QlikView Management.

QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More

Changing OneAndOnlyOne ("Always One Selected") on QVS from macro


I'm making a bilingual application (Russian + English) with possibility for user to change the language in runtime. In this application I have a set of fields to be "Always One Selected". I'd like also to show in Current Selections box only the fields, corresponding to currently selected language.

To make it I've made two set of corresponding fields (one russian and one english, for example Month_RU and Month_EN). If currently selected language is English, then Month_EN "Always One Selected" is checked and one selected value can be seen in Current Selections box. Month_RU "Always One Selected" is unchecked and no values are selected in Month_RU.

When user change the language I run a macro to make Month_RU select corresponding month, then set Month_RU "Always One Selected" to be checked, then uncheck "Always One Selected" in Month_EN and clear selection in Month_EN.

I.e. in any moment the user see only current language fields in Current Selections box.

This is the macro I'm using to do it:

sub SetEnglishAlwaysSetOne
call SetFieldPropAlwaysSetOne("Month_EN", true)
call SetFieldPropAlwaysSetOne("Month_RU", false)
end sub

sub SetRussianAlwaysSetOne
call SetFieldPropAlwaysSetOne("Month_RU", true)
call SetFieldPropAlwaysSetOne("Month_EN", false)
end sub

sub SetFieldPropAlwaysSetOne(FieldName, OnlyOne)
set fld=ActiveDocument.GetField(FieldName)
if fld.GetValueCount(1) = 0 then
set val=fld.GetPossibleValues
if val.Count=1 then
fld.SelectValues val
end if
end if

if fld.GetValueCount(1) = 1 then
set fprop = fld.GetProperties
fprop.ShowAlternatives = false
fprop.OneAndOnlyOne = OnlyOne
fld.SetProperties fprop
if not OnlyOne then
end if
end if
end sub

This stuff works perfect when qvw-file is opened in standalone QlikView application. But when running on QlikView Server - the macro can not change OneAndOnlyOne property. The server is Version 9 SR1.

Is there any limitations in changing this property when running application on Server or it is just a bug?

If this is a limitation (and may be not the only one), so where I could get a full list of those server-side macro limitations?

Also, is there any example of macro to use instead "Always One Selected" option and make a field behave like this option is checked?

Thank You.

1 Reply
Not applicable

Re. :Changing OneAndOnlyOne ("Always One Selected") on QVS from macro


It's not possible to use the "SetProperties" in a Macro with 'Client-Server'.

Look at QV Manual: Book II Part III 30.2... or the 'Qlikview automation reference'.