EScript Array Sort Function Resulting In Incorrectly Sorted Array (Doc ID 2244857.1)

Last updated on MARCH 16, 2017

Applies to:

Siebel CRM - Version 15.6 [IP2015] and later
Information in this document applies to any platform.

Symptoms

On : 15.6 [IP2015] version, Siebel VB / eScript / COM

ACTUAL BEHAVIOR
---------------
eScript Array sort function resulting in incorrectly sorted array

While sorting two dimensional arrays using escript function: arrayName.sort([compareFunction]), it is returning incorrectly sorted array.

Details:
Customer is implementing eScript code which requires to sort an Array of Objects using two criteria (sort using first criterion, followed by sort using second criterion).
The problem occurs when they set the Array elements using the first sort criterion and execute second sort. The expectation after second sort is that the Array indexes are retained because the comparison function returns zero.

However first Array elements ends up as the last element.

In general, when executing sort using any two dimensional Array, if the compare function returns zero or -1, the first element before sort ends up as the last element after sort for any group of elements which have the same comparison value.

EXPECTED BEHAVIOR
-----------------------
While sorting two dimensional arrays using escript function: arrayName.sort([compareFunction]), the sorted array should be returned correctly.

STEPS
-----------------------
The issue can be reproduced at will with the following escript:


BUSINESS IMPACT
-----------------------
The issue has the following business impact:
Due to this issue, users cannot use escript function: arrayName.sort([compareFunction]).

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms