Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Im using a macro to set 'Always one selected' Property for a listbox.
For eg: 'Currency' Field
In one Tab, 'Currency' Field should have default selection as 'Euro' and the same field should be cleared in another sheet (No value selected).
It was working in my development environment , But not in the accesspoint. Please let me clear what may be the problem
Im using the following macro:
Sub Select
ActiveDocument.Fields("Currency").Select "EURO"
set fld1 = ActiveDocument.GetField("Currency")
set fprop1 = fld1.GetProperties
fprop1.OneAndOnlyOne = true
fld1.SetProperties fprop1
End Sub
Sub Clear
set fld = ActiveDocument.GetField("Currency")
set fprop = fld.GetProperties
fprop.OneAndOnlyOne = False
fld.SetProperties fprop
ActiveDocument.ClearAll
End Sub
First macro in one sheet , for the default selection and second one for clearing the macro
It was not working in the accesspoint
Can anyone help me in this? where Im doing wrong...
Thanks in advance,
Dhoulath
Same issue here on QV10 SR4... just found a workaround that seems to work for me in AJAX and Desktop client.
BEFORE, I was using this code (slightly modified) from the APIGuide and it would not work on document OnOpen or a Button or any other trigger, but it works fine in Desktop client:
'Selects first value of Dim1
set fld = ActiveDocument.GetField("Dim1")
fld.TopSelect "MaxString(Dim1)", 1
'Sets "Always One Selected" property for Dim1
if fld.GetValueCount(1) = 1 then
set fprop = fld.GetProperties
fprop.ShowAlternatives = false
fprop.OneAndOnlyOne = true
fld.SetProperties fprop
end if
Apparently, my QV Server 10SR4 wasn't picking up my IFieldProperties object and something was breaking in the SetProperties, I assume.
NOW, I changed my code to this and it seems to be working fine with any trigger:
'Selects the first value in Dim1
set fld = ActiveDocument.GetField(Dim1)
fld.TopSelect "MaxString({1} Dim1)", 1
'Sets "Always One Selected" property
if fld.GetValueCount(1) = 1 then
fld.GetProperties.OneAndOnlyOne = true
fld.GetProperties.ShowAlternatives = false
end if
Things seem to be working now. Has anyone confirmed this with QlikView as a bug? Is something going on with their IFieldProperties object or the Field.SetProperties command?
Let me know if this solves your issues. Attaching QVW as sample.
EDIT: this works for me, but has not worked for a co-worker.
This is not working for me in QV 12. SR5.
It "seems" to work as long as if you are using "Classic" for listbox presentation.
If you switch presentation to checkboxes, you will probably find that multiple values are beeing selected when a additional value is being selected.
Regards - Marcel