Modify

#4002 closed Bug (No Bug)

Only some _ArrayX functions have their Failure Return value documented

Reported by: lwc Owned by:
Milestone: Component: Documentation
Version: 3.3.16.1 Severity: None
Keywords: return-value Cc:

Description

The documentation of _ArrayX functions usually separates the return value to:

  1. Success
  2. Failure
  3. @error

But in cases like _ArrayFindAll it separates the Return value to:

  1. Success
  2. Failure - which actually describes @error and not failure! I.e. it doesn't mention that it returns -1 (which is the standard in _ArrayX functions)

I think it's important because checking for a general not @error should be a last resort, only after first directly checking if there was no failure.

_ArrayX functions which don't their Failure Return value documented - and the needed fix (which I've confirmed):

  1. _ArrayCombinations - failure actually returns 0
  2. _ArrayFindAll - failure actually returns -1
  3. _ArrayFromString - failure actually returns an empty array
  4. _ArrayMax - failure actually returns blank
  5. _ArrayMin - failure actually returns blank
  6. _ArrayPermute - failure actually returns blank
  7. _ArrayPop - failure actually returns blank
  8. _ArrayToString - failure actually returns blank
  9. _ArrayUnique - failure actually returns blank
  10. _Array1DToHistogram - failure actually returns blank
  11. _Array2DCreate - failure actually returns blank

That's more than a third of those functions (11 out of 32).

Attachments (0)

Change History (2)

comment:1 by J-Paul Mesnage, on Mar 23, 2024 at 1:42:49 PM

Resolution: No Bug
Status: newclosed

Hi,
Thanks for reporting.
But in this case the Failure must be becked with "If @error"
It is the way the Udf is designed to "work"

in reply to:  1 comment:2 by lwc, on Mar 23, 2024 at 3:56:17 PM

Replying to Jpm:

It is the way the Udf is designed to "work"

But it does in fact always return something and it's official in 2/3 of those functions. Do you mean for those specific 1/3 of the functions it's unofficial and subject to future change?

In any case it's less efficient since it doubles the lines from 1 to 2, for example:

_ArrayFindAll($arr, " ") // no return value is even needed if it's just to check if it worked or not
if not @error then

instead of just:

if isarray(_ArrayFindAll($arr, " ")) then

or

if _ArrayFindAll($arr, " ")<>-1 then

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.