Hi, I'm new here I need help.
The problem is that I would first have to split a text (with special character separation) and then I would only need the first x characters of the elements of the resulting list (also a special character indicates how long), also in a list.
I think somehow the "Split", "Find" and "Left" functions should be combined if possible ...
Any Idea?
I think the basic challenge is that Split() will generate a List but that the various text functions like Left() and Find() will only act upon a single Text item. Here is a quick test using an app I'm working on:
First just looking for the values associated with an EnumList of type Ref (this just happens to be the easiest example of a list I have in this app, but the same would apply to a string which was split)
[System ID][Value]
The result is a list of Text values, the split command automatically separates them with " , "
SAP LI3 , Google Sheets , Google Email , Opentext
Now if I try to use LEFT() on this
Left([System ID][Value], 3)
I simply get the first 3 characters of the whole list string
SAP
If I wanted the first three characters of the second item on the list, then I would have to pull it out from the list first using Index()
Left(Index([System ID][Value], 2), 3)
The result is
Goo
I could use multiple index and left functions and wrap them in a List()
List(
Left(Index([System ID][Value], 1), 3),
Left(Index([System ID][Value], 2), 3),
Left(Index([System ID][Value], 3), 3),
Left(Index([System ID][Value], 4), 3)
)
This would provide the sort of thing you are looking for
SAP , Goo , Goo , Ope
But obviously is time consuming to write and requires that you know in advance the maximum number of list entries there are expected to be as well as probably using some additional tricks to account for fewer numbers of entries.
In short there is not an efficient and reliable way to perform text operations on each member of a list.
Dear Graham,
Thanks a lot.
Once the number of list items is maximized, I think it will work. i just don't know what happens if the number of list items is less than the indexes written in the formula ... (if the function just doesn't do anything, it will work)
Anyway, I'm much closer than i was
If I remember correctly, I think that index() will simply return blank if you try to select a position which is too high. So everything may well work correctly.
One specific list item |
User | Count |
---|---|
37 | |
31 | |
29 | |
22 | |
18 |