2 Replies Latest reply: Dec 19, 2012 11:16 AM by dabaipang RSS

    Help! How to make sort on an expression in extension

      I am having this Definition.xml

      <ExtensionObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Definition.xsd" Label="SelectionMapCAFireBug" Description="SelectionMapCAFireBug" PageHeight="20">

                <Dimension DropTarget="1st Dimension" Initial="=PrescriberId"/>

                <Measurement DropTarget="Measure" Initial="" />

                <Measurement DropTarget="Measure" Initial="" />

                <Measurement DropTarget="Measure" Initial="" />

                <Measurement DropTarget="Measure" Initial="" />

                <Initiate Name="Chart.Title" value="Map"/>

                <Initiate Name="Chart.Expression.0.0.Definition" value="=Sum(Vials)"/>

                <Initiate Name="Chart.Expression.1.0.Definition" value="=Latitude"/>

                <Initiate Name="Chart.Expression.2.0.Definition" value="=Longitude"/>

                <Initiate Name="Chart.Expression.3.0.Definition" value="=ZipCode"/>

                <!-- !IMPORTANT: Set the initial size of the QV map-->

                <Initiate Name="Layout.Normal.Width" Value="500" />

      </ExtensionObject>

       

       

      I would to sort by descending order on   <Initiate Name="Chart.Expression.0.0.Definition" value="=Sum(Vials)"/>

       

      I saw this post(http://community.qlik.com/message/241769) which is making a sort on dimension, but in my case, I need to have it in my expression.

       

       

       

      Please help!

       

      Thank you very much!

        • Re: Help! How to make sort on an expression in extension
          Alexander Karlsson

          Hey,

           

          I'll answer here as well so we can reference it later on.

           

          You could add something like the line below to your definition.xml file:

          <Initiate Name="Chart.Dimension.0.Sort.ByYValue.Use" value="1"/>

           

          There is a qvprops.htm file that exposes all the different chart properties. I've searched and searched but it seems we have removed it from the SDK so I'll just upload it here instead with reservations that it might be outdated.

            • Re: Help! How to make sort on an expression in extension

              Hi Alex:

               

              Very appreciate your reply.

              I tried this suggetion in extension, it doesn't work. Here is my Definition.xml

              <ExtensionObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Definition.xsd" Label="Top N - 2" Description="Top N Selection - 2" PageHeight="20">

                        <Dimension DropTarget="1st Dimension" Initial=""/>

                        <Measurement Label="Sum(Vials):" Initial="=Sum(Vials)" />

                        <Measurement Label="Latitude" Initial="=Latitude" />

                        <Measurement Label="Longitude" Initial="=Longitude" />

                        <Measurement Label="ZipCode" Initial="=ZipCode" />

                        <Initiate Name="Chart.Title" value="Map"/>

                        <!-- !IMPORTANT: Set the initial size of the QV map-->

                        <Initiate Name="Layout.Normal.Width" Value="500" />

                        <Initiate Name="Chart.Dimension.0.Sort.ByYValue.Use" value="1"/>

              </ExtensionObject>

               

              But I think this idea should be right becase 'sort by Y value' is working in a standard chart object.

              Here is what I tested: I put this 'sort by Y value' in a standard chart with  Dimension = Id, Expression = Sum(***) and a couple of other columns, and then set 'sort by Y value - descending' on Dimension id, the bar chart looks right to me, the id is sorted by descending order of Sum(***).

               

              Is it because some syntax error in my definition.xml causes not working in extension?

               

              Thank you very much!