#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:
- Success
- Failure
- @error
But in cases like _ArrayFindAll it separates the Return value to:
- Success
- Failure - which actually describes @error and not failure! I.e. it doesn't mention that it returns -1 (which is the standard in
_ArrayXfunctions)
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):
_ArrayCombinations- failure actually returns 0_ArrayFindAll- failure actually returns -1_ArrayFromString- failure actually returns an empty array_ArrayMax- failure actually returns blank_ArrayMin- failure actually returns blank_ArrayPermute- failure actually returns blank_ArrayPop- failure actually returns blank_ArrayToString- failure actually returns blank_ArrayUnique- failure actually returns blank_Array1DToHistogram- failure actually returns blank_Array2DCreate- failure actually returns blank
That's more than a third of those functions (11 out of 32).
Attachments (0)
Change History (2)
follow-up: 2 comment:1 by , 2 years ago
| Resolution: | → No Bug |
|---|---|
| Status: | new → closed |
comment:2 by , 2 years ago
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

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"