4 Replies Latest reply: Apr 28, 2014 12:02 PM by Steve Lord RSS

    How to write 'always only one selected' into script for a field?

    Steve Lord

      Hi, I use the 'always only one selected' checkbox on a particular listbox where it is important to have such a constraint.  Is there is a way to hardcode that onto that field in the script itself?

        • Re: How to write 'always only one selected' into script for a field?
          Michele Barini

          Hi,

          you could add some triggers on that field to select always the maxstring(YourField) value

            • Re: How to write 'always only one selected' into script for a field?
              Steve Lord

              That looks like something to make the dashboard pick a particular (last) value in the field when something happens to trigger it.

               

              If I have a piece of script like this:

               

              LOAD ClientAccountID,

                   ClientAccountName,

                   OfficeID

              FROM

              [<filepath>\ClientAccounts.qvd]

              (qvd);

               

              Where/how would I write that trigger onto the ClientAccountName field.

               

              Also the other issue is that when we recover the qvw from source control, the checkbox for 'always only one value selected' on the clientaccountname listbox itself unchecks itself because there is no data present until we reload the qvw.  I was hoping for a piece of script to force that property back onto that field whenever the qvw is reloaded so nobody has to remember to go in and check that checkbox if we have to recover the qvw someday again in futureworld.  Is there script to apply the property of always only one value selected that I could write in after the script to select maxstring?

               

              So the sequence of events in script might be like:

              1. Load stuff from place

              2. Trigger always select maxstring(clientaccountname) to select a value in the clientaccountname field

              3. Force property 'always only one value selected' onto the clientaccountname field.

               

              Then when the script is reloaded, it automatically selects a client name, then locks that field to have always only one value selected.  But it should let the end user select any one other client at a time from the list box.

               

              I could use the document properties triggers to make the document select a client name easy enough I think, but how do I get that always only one value selected checkbox property checked in an automated way?

                • Re: How to write 'always only one selected' into script for a field?
                  Steve Dark

                  As far as I am aware there is no simple way of achieving this.

                   

                  It is a problem when a field has no values in it at some point (eg. load failure or data reduction) and then is reloaded - as the Only One Selected value will be cleared at this point.

                   

                  You can probably put the selection on using Macro code and a trigger, but this is not really ideal.

                   

                  Steve

                    • Re: How to write 'always only one selected' into script for a field?
                      Steve Lord

                      Yeah, macro/vb/java stuff won’t be an option at all for any qlikview that has scheduled reloads via the qv management console.  qvmc simply refuses to reload qlikviews that have macros and people have to fall back to windows task scheduler and/or other apps after that.  We kind of suspect someone could give qlikview people a hundred thousand dollars for a package that allows more absolute automation. ☺  I know the enterprise qvmc has more flexible scheduling options, but pretty sure it doesn’t let you schedule reloads of qvs with macros either.  Or maybe they do the reloads and just ignore the macro if done from qvmc I forget.

                       

                      I am exploring the document properties triggers but may end up settling for colleagues needing to know they need to re-check that box if they ever have cause to recover something from source control.