Allow to check the length of an array without having to store it into a variable

Right now you need to create a variable in which you store the length of an array if you want to check its length in a condition.

It would be nice if this kind of thing would be possible in the EXPRESSION directly.

@sebme Thanks for the suggestion. This is fairly straightforward, so we will see if it is possible to prioritize it. What is the use case that brings up the need for you?

Hi pete,

we are fetching a delimited string from a BOM, split it and use its contents to determine what steps need to be displayed to the operator.

E.g.

“Step1,Step2,Step3”

If ther is only one specified, we would like to send the operator straight to that step.

Along the lines of

  1. Fetch BOM item
  2. Split it by delimiter
  3. Get the length of the resulting array
  4. If the resulting array has a length == 1: only fetch the first element of the array and use that as the operator destination.

Right now this requires to go via another variable to determine the array length. And if it is only 1, then we know we can safely fetch the array element at index 0 to send the operator to the right step.

That by itself is not a big deal. However, our app has already so many variables that I would prefer to not have to introduce further “helpers” to get to the desired result.

@sebme Awesome, thanks for the details!

This sounds like a great idea. Voted!

We also had this use case many times with customers, voted :slight_smile:

Thanks for voting! Can definitely see how this would be helpful and we do have an internal ticket tracking this still :slight_smile: Tapping @jakerigos to see if he has any additional information he can provide!

Thanks for all the input here - will chat with the team and see what we can do to make this happen.

Sincerely,

Jake

I have the same use case.
I would also love to get a value from index (you can actually get the index by value) and “pop from array”…

The use case can be something like getting a value from the index, make it an integer and save it as integer without the need of saving a text value before and make an additional action to manipulate it…


Edit:
This was also metioned here before:

1 Like

@sebme for this use case (to only find if the array length is only 1) you can use the workaround I mentioned here:

Not a beauty in readability, but it works in most cases…

1 Like

I really hope they soon come up with a native way to do things like these… these workarounds are terribly ugly and derail any logic.