Getting item index on a list

Hi fellas, I need some help if this is possible.
I’m using this block to get the item index and get some changes to that item. But the problem is it requires a complete string on that item to get the item index. What I wanted to do is, to get the item index that contains the string even if it is not complete.

1 Like

these blocks look complicated…
what about providing an example, so anyone is able to understand, what you are trying to do?

Taifun

Hi there, heres the output of the blocks above. Have some changes but not much. AIA is also included. What i wanted is to get the index eventhough string provided is not complete and as long as that index value contains the string provided.

[Uploading:

TESTT.aia (1.1 MB)

so if you have the list

ONE ALPHA
TWO BRAVO
THREE CHARLIE

if I understand correctly, you like to be able to search for a partial item (for example BRAVO) and replace the first occurence in the list by something else, in the example TWO BRAVO by TWO ZEBRA

and in case someone searches only for the letter A, you like to replace the first occurence (which is ONE ALPHA) by ZWO ZEBRA, is that correct?

Taifun

Yes, maybe. Let me just ask this to make it simplier. How can i get the index of an item using a partial text/value of it?

The first one i think you got it but the second one w/c you have a scenario, just got confused

it you want to use lists, then the cotnains block is the way to go as you already have it…

but let me recommend you to store your data in the SQlite database, which would give you much more flexibility and you need less blocks to sort or filter or replace something…

UPDATE myTable SET myColumn to "TWO ZEBRA" WHERE myColumn LIKE "%BRAVO%"

however this will not only replace the first BRAVO, but all BRAVOs found… if you only need the first, you probably can do it like this

UPDATE myTable SET myColumn to "TWO ZEBRA" WHERE myColumn LIKE "%BRAVO%" LIMIT 1

see also both answers here

Taifun