Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help to write a macro

Dear All,

Can anyone please help me to write or modify my macro.

Actually my Current Macro help me to do Sort by in the Chart Object,but only if i Select any one Field if more than one field appears or a single field appears,

I want a macro which should help me to sort the Objects by Default if only one field apperas in Sort by Object.

Ex:

I have a list box as Measures, if i select any field in Measures then Some fields come in my new Table as Sort by as Caption, If i Select any 1 Sort by Fields it Does the Sorting but if Only one Fields Come in the Sort By Caption then I have to Selct it to do the process but i Want it to be By Default do Soring in Chart if Only one Field Apperas as Sort By.

My Current Macro is :

for iloop=0 to objML.count-1

                if (objML.Item(iloop).Text=ActiveDocument.GetVariable("ML_Sort_UA2").GetContent.String) then

                    sortBY1=iloop

                    exit for

                end if

            next

                    a=0

                  if(sortBY1<>"") then

                Mnu2 = objM.Item(sortBY1).Text   

            end if

               for j=0 to objM.count-1

                if(a=0)then

                    chart.AddExpression Mnu2

                    set p = chart.GetProperties

                    set exps = p.Expressions.Item(0).Item(0).Data.ExpressionVisual

                    if Charttype="ComboChart" then

                        exps.ShowAsBar = false

                        exps.ShowAsLine = true

                         exps.ShowAsSymbol = true

                     End if

                     'exps.Label.v = objML.Item(sortBY1.GetContent.String).Text

                     exps.Label.v = objML.Item(sortBY1).Text

                     chart.SetProperties p

                    a=a+1

                end if

                if(a<>0) then

                    if(Mnu2<>objM.Item(j).Text) then

                        Mnu1 = objM.Item(j).Text

                        chart.AddExpression Mnu1   

                        set p = chart.GetProperties

                        set exps = p.Expressions.Item(a).Item(0).Data.ExpressionVisual

                        if Charttype="ComboChart" then

                            exps.ShowAsBar = false

                            exps.ShowAsLine = true

                             exps.ShowAsSymbol = true

                         End if

                         exps.Label.v = objML.Item(j).Text

                         chart.SetProperties p

                         a=a+1

                    end if

                end if

Please Help Regards,

Pranav

0 Replies