Playing with lists - some ideas

Hi all,

Lists and their functions are probably one of the least-known capabilities in Text Blaze. In this thread, I'd like to share a small snippet that I've been playing around with. I started it as a way for me to better understand how lists work, but then I figured you al might find it useful.

Here it is:

Enter your list items in the box below - one item per row

{formparagraph: name=text}
{list=filter(split(text, "\n"), item -> item <> "")}

{if: count(list)==0}Your list is empty

{else: trim=yes}This is the list {=list}

Your list contains {=count(list)} items

Search for this item in the list (case-sensitive): {formtext: name=string}

{if: string==""}Nothing to show{elseif: includes(list, string)}String "{=string}" is in position {=location(list, string)} in the list{else}Item not in list{endif}{endif}

Now, let me walk you through it.

  1. I've set up a formpargraph command with the name "text". This is where I input the contents of my list - one per line.
  2. Next, I'm creating a list called "list". Here, there are a few things happening. The split function is taking the contents of the "text" variable and splitting them up according to line breaks. That's what the "\n" means (think "new line").
    Then, the filter function is literally filtering the list to remove empty entries. That's what item -> item <> "" means. You don't need to use the word "item" either. Just pick whatever you want.
  3. Now we have the list called "list", which comprises all of my non-empty entries. In other words, if I insert a bunch of empty rows, they will be ignored. And this is important because when I'm using the count function to count items in my list, I don't want it to count any empty rows.
  4. Next, we have an if command. Here, I want to present a different text based on the contents of my list. If the list count is zero, I get the first bit of text "Your list is empty".
    If the count is not zero, I get the other piece of text, which shows me the contents of the list and the count of the items.
  5. In the final bit, I added a formtext command named "string". I use the contents of "string" to find out whether they exist in my list, and if they do, which position they're at in the list.
    The includes function checks the list to see whether the text extists in it.
    The location function checks which position that bit of text holds in the list.

As it is, this snippet won't do much for you. It's more intended to show you what lists can do and maybe trigger some ideas of how you can use them.

But if you think you might be able to apply these concepts in any of your snippets, let's discuss it in this thread and work on your snippet together.

On a final note, here are the links to the documentation for each of the commands and functions I mentioned in this post:

Hope this helps :slight_smile:


@George_Marinos - I think you might find some ideas in this.

Thank you very much


I also have a "LIST" challenge that I would really appreciate help with?

If I have a list of 100 names (first name + surname), each with a corresponding ID number, office name and postcode.

In a snippet I want to add all 5 pieces of information (first name + surname + corresponding ID number + office name + postcode) but can only recall surname or postcode or full name, can I do a quick search and then enter all details in the snippet?

I have the list of names, corresponding ID number, office name and postcode in an excel spreadsheet. Can it be imported into a snippet easily?


Hi @George_Marinos, I swear your snippets will be the end if me lol.

Joking apart, interesting challenge. Lemme chew on it a bit and see what I can come up with.

Quick question, will the data set remain unchanged, or will there be additional entries over time?

The data will change as people will change their address and their respective ID number; plus new people (Drs) will be added onto the dataset.

I found something close on the Q & Help section

but can't seem to understand it or able to apply it to my problem; a menu of all the names in an alphabetical order would be a solution? Not sure how to add new people?


If the data is changing, then it doesn't make sense to have that data inside text Blaze as you run the risk or querying obsolete data.

That said, there are options for working with external data, including urlload and clipboard.

Is thus data on a Google sheet from the get go or are you exporting it from elsewhere?

I can place in onto a Google Sheet - from where I can update the data and Alphabetise it.

An example of the list is shared with you

It is not a confidential list (downloaded from Yellow Pages)


I think the simplest way would be to run the search in the google sheet itself. Once you've found what you needed, you highlight the relevant row and copy it.

Then use the following snippet:

{FullName=split({clipboard}, "\t")[1]}
{FirstName=split({clipboard}, "\t")[2]}
{Surname=split({clipboard}, "\t")[3]}
{Suburb=split({clipboard}, "\t")[4]}
{Postcode=split({clipboard}, "\t")[5]}
{ProviderNumber=split({clipboard}, "\t")[1]}

FullName: {=fullname}
FirstName: {=firstname}
Surname: {=surname}
Suburb: {=suburb}
Postcode: {=postcode}
ProviderNumber: {=providernumber}

I'll give it a try.

Is there any way that Text Blaze can at least open the spreadsheet so as to automate the opening process, which then leaves only to open the "find" dialogue box and then copy to clipboard?


Not really, but you could put a link to the spreadsheet inside a note command, so when you insert the snippet, you get the popup which includes the link to the spreadsheet, making it easily accessible.

Hi @Cedric_Debono_Blaze !

I have a snippet for extracting the customer name in the chat, but I had the issue where the customer would have a bad word for a name... So I added a list to the snippet, and using the =includes() function to try to filter bad words.

It works most of the times, but sometimes there's a customer using the name "Carldork". I have "dork" in the list, but the =includes() does not recognize it, since the full string is "carldork".

Now, I've tried using the =contains() instead, but I can't seem to make it work. Any ideas on how I would make a fully working filter?

I could do it like this --> {if: contains({=Name}, {=swear}[1] or contains({=Name}, {=swear}[2]... etc etc}, but the list contains 35 items, the code would be a little extensive... Haha. Actually wanted to see if there's a way to shorten this.

Hi @Cedric_Debono_Blaze

I'm new to Blaze, but what a great little app! :slight_smile:

My question is linked to the lists - is there a way to list the items with numbers or bullet points, or to format the text?

Thank you,

1 Like

Hi @Alex_Petcu - welcome to the forum!

is there a way to list the items with numbers or bullet points, or to format the text?

Absolutely :slight_smile:

Here are some examples:

{list=["item a", "item b", "item c", "item d", "item e"]}

{=join(list, ", ")}

Comma-separated + "and"
{=join(list, "BLAZE_AND")}

Comma-separated + "or"
{=join(list, "BLAZE_OR")}

Line-break-separated + numbering and title capitalization
{=join(map(list, item -> location(list, item)&". "&proper(item)), "\n")}

Hope this helps.

You can read more about these functions here:

And of course, any questions, ask away! :slight_smile: