Skip to main content
Announcements
Defect acknowledgement with Nprinting Engine May 2022 SR2, please READ HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
morganaaron
Specialist
Specialist

Sort order for levels within nPrinting?

Hi there,

I've created a number of excel reports with nPrinting, and have set levels up using a Customer Type within one of the reports. This works fine, i.e. each chart is appearing fine for each individual level, but the Customer Type is sorting alphabetically, so my top level is 'Independent' and my last one is 'Undisciplined'. As part of these types I have 'Total' and 'Freetrade' which is a combination of Independent and Undisciplined. Because of this, I want to change the sort order of my level so that I can control which appears first.

At the minute I'm only able to do this by creating another field (Customer Type Sort Order) in Qlik and using this as the level and then using a formula (Only(Customer Type)) to return the Customer Type, but I wondered if there's a way to control the level order within nPrinting, or to atleast change it to load order instead of alphabetical?

Thanks.

1 Solution

Accepted Solutions
Not applicable

Ordering is based on the QlikView sort order for the dimension used in the level. There is no way to change that other than by:

  1. Changing the sort order of the dimension in the QVW
  2. Creating a dummy dimension (as you did) to set the sort order.

If you were sorting values of a dimension in a table, you could use the Excel sorting to set the sort order rules, but for levels there are fewer options.

View solution in original post

8 Replies
Not applicable

Ordering is based on the QlikView sort order for the dimension used in the level. There is no way to change that other than by:

  1. Changing the sort order of the dimension in the QVW
  2. Creating a dummy dimension (as you did) to set the sort order.

If you were sorting values of a dimension in a table, you could use the Excel sorting to set the sort order rules, but for levels there are fewer options.

aadil_madarveet
Partner - Creator II
Partner - Creator II

I encountered a similar problem and they way i solved it is by sorting the field in the script itself to the required format and then setting the sort in the document properties to the desired format.

For instance if your level is customer type. Sort this field in the script itself in the same order you would want to generate the report in. After this in the document properties, verify the sorting order of the field is set to Load order-> Original.

This will generate the report in the same order they way values or sorted in the QVW.

another alternate option is, no matter what the sorting of values is in the tabels, you can still change the sorting of the field in the Document Properties and then generate the reports.

hope this helps.


Thanks,
Aadil

morganaaron
Specialist
Specialist
Author

Hi both,

Thanks - completely forgot you can set the sort order as part of the document properties instead of just within a given object!

Aaron

Colin-Albert

Defining a field as Dual(), with the numeric part holding the sort order, allows dimensions to be sorted in a non-alpha  or custom sequence without the need to specify a different field on the sort tab

morganaaron
Specialist
Specialist
Author

Thanks Colin - I've tested it with a dual field but found that it reads this field in as numeric when using levels, meaning you can't use the node to represent the field name and have to write out a formula to read in the text part of that field - still works using that method though, so added to the list!

AdnanMirza
Contributor II
Contributor II

Hi Aaron, 

I am facing the same problem. I tried using dual but it returns the numeric part of the dual function using the field as a level (as you mentioned in your comment down here).

Could you please share the script of your first solution where you created a new field and then used the Only function?

Thank you

Adnan

Ruggero_Piccoli
Support
Support

Hi,

As best practice please avoid to comment 7 years old conversations.

Try to create a straight table in the source app with the column you want to use as level and another to sort. Then refresh the connection cache, close and reopen the Designer and use that new table to create the level.

Best Regards,

Ruggero



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.
AdnanMirza
Contributor II
Contributor II

Thank you @Ruggero_Piccoli

I created a new table in the app and sorted the column using "sort by expression" in the Sorting tab. Then I used this table as a level in designer. It worked!! thanks again.

Adnan