Data-flo
Data-floSource CodeCGPS
  • INTRODUCTION
    • What is Data-flo
    • Getting Started - Sign In
    • Privacy and Terms Of Service
    • Contact - Help & reporting errors
    • Change log
  • USING DATA-FLO
    • Data-flo site navigation
      • Transformations Page
      • Run Page
      • Canvas
    • Data
      • Bringing data in to Data-flo
      • Getting data out of Data-flo
      • Data Types
        • Boolean
        • Datatable
        • File
        • Graph
        • List
        • Map
        • Number
        • Text
    • Regular Expressions (RegEx)
    • Adaptors overview
      • Components of an adaptor
      • Binding types
        • Bind to Data-flo input
        • Bind to value
        • Bind to another transformation
    • Specific adaptors
      • add-column
      • append-to-list
      • calculate-time-difference
      • change-column-case
      • columns-concatenation
      • concatenate-text
      • create-microreact-project
      • csv-file-to-datatable
      • csv-to-datatable
      • datatable-columns
      • datatable-to-csv-file
      • datatable-to-graph
      • datatable-to-list
      • datatable-to-map
      • datatable-to-sqlite-file
      • date-to-text
      • dbf-file
      • dot-to-graph
      • download-file
      • dropbox-file
      • epicollect-project
      • extend-datatable
      • figshare-file
      • file-to-text
      • filter-blank-values
      • filter-columns
      • filter-list
      • filter-rows
      • filter-rows-numerically
      • force-directed-layout
      • format-date-column
      • forward-geocoding
      • ftp-file
      • gather-rows
      • google-drive-file
      • google-spreadsheet
      • graph-to-dot
      • join-datatables
      • list-to-datatable
      • lookup-map-value
      • merge-datatables
      • merge-lists
      • microreact-project
      • mysql-database
      • newick-leaf-labels
      • oracle-database
      • postgress-database
      • prepend-to-list
      • remove-columns
      • remove-duplicate-rows
      • rename-columns
      • replace-blank-values
      • replace-column-values
      • replace-text
      • replace-text-in-list
      • replace-value
      • reverse-geocoding
      • row-column-value
      • s3-file
      • select-columns
      • send-email-message
      • slice-datatable
      • slice-list
      • smb-file
      • sort-datatable
      • sort-list
      • split-column
      • split-datatable-rows
      • split-list
      • split-text
      • spread-rows
      • spreadsheet-file
      • sql-server-database
      • sqlite-database
      • sum-rows
      • text-template
      • text-to-file
      • unique-list-items
      • update-epicollect-entries
      • update-microreact-project
      • update-smb-file
      • upload-file-to-google-drive
      • upload-files-to-google-drive
      • url-builder
      • yaml-to-json
    • Building a data-flo
      • Debugging mode
      • Show detailed errors on Run Page
      • Permissions - Access Control
    • Tips & Tricks
  • TUTORIALS
    • Prep outbreak data for Microreact
    • Common use cases, solved
      • Fixing datatable headers
      • Select, remove, rename, reorder columns
      • Data in separate files
      • There's no single-column unique row ID (primary key)
      • Ensure non-dates stay non-dates
      • Connect directly to a database
      • Access files on a drive
Powered by GitBook
On this page
  • Arguments
  • Example
  • Original data
  • Sort by column3 (asc), then by column2 (asc)
  • Sort by column2 (asc), then by column1 (desc)
  • Possible use cases

Was this helpful?

  1. USING DATA-FLO
  2. Specific adaptors

sort-datatable

Alphabetically sorts the rows in a datatable

Sorts the rows in a datatable based on values in one or more columns.

TIP: Numbers are treated as text (e.g. list order will be 1,12,2 instead of 1,2,12).

Arguments

Inputs:

data: The datatable to be sorted.

columns: A map of columns used for sorting. The datatable will be sorted by the 1st map item key (column name). The value should be 'asc' or 'desc'. If there is a 2nd item the dataframe will then be sorted by this.

Output:

data: A sorted datatable.

Example

Original data

column1
column2
column3

A

100

category1

B

50

category4

C

25

category2

D

200

category3

E

200

category1

F

50

category1

(Note column2 sorting results show effects of numbers sorted as text)

column1
column2
column3

A

100

category1

E

200

category1

F

50

category1

C

25

category2

D

200

category3

B

50

category4

(Note column2 sorting results show effects of numbers sorted as text)

column1
column2
column3

A

100

category1

E

200

category1

D

200

category3

C

25

category2

F

50

category1

B

50

category4

Possible use cases

  • Place high-impact rows at the top of a data set (e.g. to be easiest to find in Microreact data table)

  • Organize data for sharing in a report

Previoussmb-fileNextsort-list

Last updated 2 years ago

Was this helpful?

Sort by column3 (asc), then by column2 (asc)

Sort by column2 (asc), then by column1 (desc)