Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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

How to remove a field in a multibox, using a macro ?


I have a field in the document, by the name Market (with data M1,M2 and M3). I have a multibox with fields A, B and C(for each of the markets present in the field called, Market).

Once the document is reloaded and reduced, based upon the values present in the Market field, the fields in the multibox should be removed.i.e, if after reduction, the Market field does'nt have the value, M3 - the field called C should be removed from the multibox, as well.

So far, i could get upto here: But I do not want to make these selections inside macro - is there any other way ??

sub macrocode

     set mb =  ActiveDocument.GetSheetObject("MB01") //fetch multibox id

          set f1 = ActiveDocument.Fields("Market").Select "M1"

               if f1 <> 1 //if it cant find a value M1 in the field, Market

                    mb.RemoveField 0    //removing the corresponding field(say A) from the multbox (making sure that A is the first field in the multibox)

               end if


          //Same condition as above for a different market....so on

Tags (4)
2 Replies
Not applicable

Re: How to remove a field in a multibox, using a macro ?

By Selections inside macro- all I mean is the Select "M1" phrase...

MVP & Luminary
MVP & Luminary

Re: How to remove a field in a multibox, using a macro ?


Create two multiBoxes with different set of fields then show and hide based on the selections like this

In Properties -> Layout -> Show Conditional

=If(GetFieldSelections(Market) = 'M1', 1, 0)

Hope this helps you, if it not works then attach some sample file.  Using Macro is not best option it doesn't work as expected sometimes.