Tutorial

Getting Started with Macros

Macro Editor

User Interface

Menus and Toolbar

Editing Macros

Macro Debugging

How To

Using variables

Finding and modifying objects

Creating new page content

Asking for user input

Storing persistent data

Using binary data

Sorting objects

Macro menus

Bulleted and numbered lists

Sample Macros

Concepts

Expressions

Objects

Properties

Variables

Data Types

Arrays

Functions

Literals

Operators

Comments

Last updated on: September 02, 2024
Also available as a single HTML file

Onetastic Macro Documentation > Functions > Array Functions > Array_SortByValue

Array_SortByValue

Sorts an array by the values.

Syntax

void Array_SortByValue(
	byref Array array, 
	Bool preserveKeys)

Parameters

Array array
Array to sort.
Bool preserveKeys
If true, the values in the array will have the same keys as before, but just order changed. If false, the values will be assigned to new numeric keys starting from zero.

Examples

$array = Array(6, 3, 7, 8, 4, 2, 3) Array_SortByValue($array, false) // $array is // 0 => 2 // 1 => 3 // 2 => 3 // 3 => 4 // 4 => 6 // 5 => 7 // 6 => 8 // Preserve keys $array = Array(6, 3, 7, 8, 4, 2, 3) Array_SortByValue($array, true) // $array is // 5 => 2 // 1 => 3 // 6 => 3 // 4 => 4 // 0 => 6 // 2 => 7 // 3 => 8

Reference

Statements

Hierarchy Objects

Page Objects

Other Objects

Functions

Array Functions

Color Functions

Data Store Functions

Date/Time Functions

Dialog Box Functions

Macro Execution Functions

Macro Menu Functions

Object Functions

Special Functions

String Functions

Window Functions