Modify

Opened 5 weeks ago

Closed 5 weeks ago

Last modified 5 weeks ago

#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 follow-up: Changed 5 weeks ago by Jpm

  • Resolution set to No Bug
  • Status changed from new to closed

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"

comment:2 in reply to: ↑ 1 Changed 5 weeks ago by lwc

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

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.