Index function that lets you search for group of characters
75
Views
3
Comments
New
Builtin & User functions

Hi,

I recently came across a scenario where I needed to get the index of the first number in the given string.

So for instance in the string "Person4", the index should be 6.


I of course can achieve this by using: Index("Person4", "4").


However if we want to get ANY number, it would be nice to provide the function with a list of characters/numbers to search for - for example: Index("Person41", ["1;2;3;4;5;6;7;8;9"]). Like this I know if any of the values in the [] appear first in the text then it should provide us with that index.


This is of course just one of the many scenarios that this can be used for. The ultimate goal would be to be able to search for more than just one static text.


I know that there are other ways of achieving the same result using multiple indexes or combining it with  other functions such 'Substr' or 'Replace' but the idea is to have an easier to use (and read) alternative.


Thanks!

this would quickly become terrain for regex functions instead of simple text functions.

Absolutely true, Dorine.

Should have pointed it out but in my case I was trying to use it in a formula of a new aggregate attribute. If it's not a built in function we can't use any of the entities attributes: 


So maybe a better idea would be to somehow be able to use Regex here. It will probably have an impact on performance but might be useful in certain situations.

aah ok,

i didn't get the context of aggregates