04-12-2024 09:18 AM - edited 04-12-2024 09:19 AM
Hello guys,
I am receiving the data like that
I'm getting the data this way, and I need each empty cell to be added to the next row of the array
As in the image below, as it is now and as it should be
I ask for your help, because I am not able to accomplish this
Solved! Go to Solution.
04-12-2024 09:40 AM - edited 04-12-2024 09:42 AM
@leandrofeder wrote:
... I need each empty cell to be added to the next row of the array
As in the image below, as it is now and as it should be
I ask for your help, because I am not able to accomplish this
There are many ways how to do this, for example
04-12-2024 10:28 AM - edited 04-12-2024 10:29 AM
Or if you prefer to have cycles, then two more variants:
I'm not sure, may be here kind of "Rube Goldberg Code" or not, but don't see any other ways for further simplification.
04-12-2024 10:39 AM - edited 04-12-2024 10:43 AM
@leandrofeder wrote:I'm getting the data this way, and I need each empty cell to be added to the next row of the array
It semes you are not adding any empty cells to the next row. You are discarding empty cells and taking them as signal to start a new row.
Something is seems wrong with your element 56 in the input array. Would that need special handling?
If we can assume that the first element is not an empty string, here's a simple explicit solution. (If the first or last element can be an empty string, small tweaks are needed, but that should get you started.)
04-12-2024 12:19 PM - edited 04-12-2024 12:36 PM
@Andrey_Dmitriev wrote:There are many ways how to do this, for example
Element at index 56 seems to contain some binary data, so there is a nonzero chance that a random \t or even double-linefeed could occur, breaking everything downstream.
@Andrey_Dmitriev wrote:
Or if you prefer to have cycles, then two more variants:
...
I'm not sure, may be here kind of "Rube Goldberg Code" or not, but don't see any other ways for further simplification.
I agree that there can still be significant simplification, e.g. no blue data at all! (see my similar code above). I also think that the constant array splitting might be hard on the memory manager, depending how smart the compiler can simplify it or not.
More efficient solution can be made, for example if we know the maximum row length beforehand.