Hello,
Is there a way to obtain a list of characters from a string, with each list item containing a single character from the string?
Example:
In js this is done by setting the delimiter to an empty string, like: SPLIT("text string", ""), but this doesn't seem to work in AppSheet.
Thanks!
Afaik, no way to do that.
For sure this could be heplful to prevent certain values on a field, for example.
It could be a feature request if there ain't no way.
@Steve Any idea?
@SkrOYC Exactly. Now you are the one reading minds ๐
Hi @Joseph_Seddik ,
Could you please add
1. If the string will be of finite length , 8 characters as you have shared or something similar or can it be a long text of any length such as 50 or 100s of characters
2. Where you plan to use this list, meaning which part of the app, a column in each row or a slice expression, etc.
3. Are you looking to have the elements in double quotes "1" , "2" etc. the way you have shown or 1, 2 will do? AppSheet list of text elements has elements without double quotes such as LIST(a, b, c, 1, 2, 3, 4)
will a workaround do?
Indeed we need reg expression with AppSheet to make our life easier rather than complex expressions etc.
Under given circumstances, to achieve what you want is to let the Looping actions to manage to split text into the list. It looks like this.
Great @Koichi_Tsuji
Yes, I was also about to suggest a similar approach as a workaround. But not with looping actions. Basically a MID() function based approach.
LIST(
MID("abc 1234",1,1),
MID("abc 1234",2,1),
MID("abc 1234",3,1),
MID("abc 1234",4,1),
MID("abc 1234",5,1),
MID("abc 1234",6,1),
MID("abc 1234",7,1),
MID("abc 1234",8,1)
)
We are not able to predict the length of the text user inputs, so only looping actions should be option to dynamially generate the list out of the text (of any length).
For a fun...
That is nice @Koichi_Tsuji . Yes , you are correct. if the length is infinite some other approach like looping actions is required. That is why , had requested @Joseph_Seddik to share the details. depending on his reply most appropriate could be suggested.
Thanks my friends.
The purpose is to validate user input of arbitrary text with unknown length, as in Valid If field.
I needed a way to execute the matching immediately. The looping action is really fun ๐คฉ and looks very nice. I have a simpler solution that is to call the js Split() function in the sheet. Both solutions however would require a form save to function; while I was looking for a way to perform this validation without needing to save the form.
I opened a feature request to have AppSheetโs SPLIT() command functioning as js (and other languagesโ) Split(); that is when you pass an empty string as the delimiter argument, a list of single-character elements will be generated.
Please have a look and vote it up if you think it will be useful to your apps. Thank you!
Hi @Joseph_Seddik Thanks for details on your use case. Got it now.
Could you update what kind validation you are trying to perform on user's text input? I mean removing special characters etc?
Yes, your feature request on SPLIT() function enhancement is a practical need. I have already upvoted it in the morning itself.
Thank you ๐
Yes, for example matching for the presence of non-alphanumeric characters. But not only that; the ability to combine text commands and list commands on the string would allow you to write expressions that achieve some of the lacking RegExp functionalities.
I usually resort to js in my spreadsheet for complex pattern matchings that I cannot achieve with AppSheet. It functions well, but requires a form save. If I need to do such pattern matching without form save, I have no way to do that.
User | Count |
---|---|
15 | |
14 | |
8 | |
7 | |
4 |