Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

customized load order

Hi,

My task is to set a customized load order.

Let's say there's a field 'Brands', and there are 5 different brands in this field.

My task is to set the following load order:

Brand 5, Brand 3, Brand 1, Brand 2, Brand 4.

How should I change this script in order to solve my task?

table1:
LOAD Brands,
FROM
C:\Users\Larisa.Filonova\Desktop\brand_data2.xlsx
(
ooxml, embedded labels, table is data)

Thank you in advance,


Larisa

1 Solution

Accepted Solutions
Agis-Kalogiannis
Employee
Employee

What you can do, before you load the main table is to create a load inline table in the script, or even an external xls file that you'll load before the main table.

The values of this table will determine the sorting of the table.

e.g.

If you use the following:

Test:

Load * Inline [

Brands

Brand 5

Brand 3

Brand 1

Brand 2

Brand 4

];


It will create a table with the above values, so later on, when you load the main table with the actual Brands field, as long as you select the Load Order option from the Sort tab on the object properties, the table will maintain these five values first.


Try it and let me know.


Don't forget to DROP the Test table AFTER you load the main table.


Thanks

Agis

View solution in original post

5 Replies
sunny_talwar

May be this will help:


table1:
LOAD Brands,
FROM
C:\Users\Larisa.Filonova\Desktop\brand_data2.xlsx
(
ooxml, embedded labels, table is
data)

Order By Match(Brands, 'Brand5', 'Brand 3', 'Brand 1', 'Brand 2', 'Brand 4');


Update: Just checked, Match won't work


Best,

Sunny

Agis-Kalogiannis
Employee
Employee

What you can do, before you load the main table is to create a load inline table in the script, or even an external xls file that you'll load before the main table.

The values of this table will determine the sorting of the table.

e.g.

If you use the following:

Test:

Load * Inline [

Brands

Brand 5

Brand 3

Brand 1

Brand 2

Brand 4

];


It will create a table with the above values, so later on, when you load the main table with the actual Brands field, as long as you select the Load Order option from the Sort tab on the object properties, the table will maintain these five values first.


Try it and let me know.


Don't forget to DROP the Test table AFTER you load the main table.


Thanks

Agis

mohamed_ahid
Partner - Specialist
Partner - Specialist

hi

try spmething like this :

order:

LOAD * INLINE [

    Brands, F2

    'brand 1', 1

    'brand 2', 2

    'brand 3', 3

    'brand 4', 4

    'brand 5', 5

    'brand 6', 6

];

let S= 'Brand 5, Brand 3, Brand 1, Brand 2, Brand 4';

for i=1 to 5

table1:

LOAD Brands,

f2

resident order

where Brands=text(subfield($(S), ',' ,$(i)));

drop table order;

dunjavsc
Contributor II
Contributor II

Hi,

Would sorting field values using this approach have any influence on the colors that are being assigned automatically to field values during data reload?

Long story short, I have this field Product:

  1. with values A, B and C
  2. value colors should be  A red, B blue, C green
  3. the field is part of drill-down dimension: Product > Subproduct
  4. drill-down dimension is used in a bar chart
  5. value colors cannot be set for drop-down dimensions (feature not supported by QS)
  6. however, it's important that Product value colors are fixed, as described in 2.
  7. Subproduct value colors don't have to be fixed BUT have to be different for each value (coloring Subproduct values by Product value wouldn't work for users)

Coloring of bar chart is done automatically (or by drop-down dimension, both are giving the same result) - which means that colors on the chart are those that were assigned to field values during data reload.

And these 'automatically assigned' colors keep switching between values randomly upon each reload - the same 3 needed colors, differently assigned.

SO the final question is - (why are the colors switching and) would sorting them like you explained in the solution fix this issue?

Thanks a lot!

dunjavsc
Contributor II
Contributor II

It does solve the problem!!! 😄