Custom sort in Data table

Hello @ppr

According to what you helped me with last time, I encouter I new issue, it’s that sometimes, there isn’t all the values. When I try with your code, I get an error as it can’t find the other values, is there anyway to make it that if doesn’t find on the values, takes the following as recurrent value ? Many thanks

Continuing the discussion from How to use custom sort in Data Table:

Just provide some more details

how the dict was created in the flow? From where are the values coming from / taken?

error message? Key not present in the dictionary?

is there anyway to make it that if doesn’t find on the values, takes the following as recurrent value ?

there are some techniques eg like a default value or sort it on begin / end. Once we can fix the requirements we can check for the details. But also please answer the questions from above. Thanks

Hello @ppr

I’m sorry for the late response, the dictionary is filled manually as u showed me previously as a build data table.

The values are retrieved from an excel file, the same onces are stored on the dictionary, but sometimes not all the files contains all the values stored in the dictionary. Which leads to an error as the key was not present in the dictionary.

If the values which are missing are in the end of the dictionary, it shows no error, but if it’s in the middle, it give me the error as key was not present

Untitled

where to to sort unknown items on the end or on the begin?

Sorry, I don’t get your question ?

@ppr

Sort it from the beginning to the end.

maybe the question was mistaking

lets assume data: North,West,South,East, South-East
Lets Assume Custom Sort order: North=1,West=4,South=3,East=2
South-East is unknown for the search order
Where to place South-East?
On End: North,East,South,East, South-East
OR
On Start: South-East,North,East,South,East,

1 Like

I get your question now. Yes, it should go at the end.

But, also let’s assume one of the custom sort order is missing, isn’t found on the file, the process sends error as one of values inside the dictionary isn’t found on the excel file.

This happens, only if the value is on the middle of the dictionary, like for example :
North=1,West=4,South=3,East=2

South, isn’t found on the excel file, it sends me error as key was not present, but if it’s West, which it’s the last value, it works fine. Even if it doesn’t exist on the excel file.

was answered above with

Ok, how to sort it from begin to end please ? With also keeping in mind the dictionary order ?

give me aliitle time

1 Like

Sure, thank you so much @ppr

find starter help here
DT_CustomSort_ArrApproach_UndefOnEnd.xaml (10.8 KB)

if needed I can give some explanations on it as well

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.