# Filter visibility by Character Count!

I’d LOVE the ability to filter visibility by `{{text_column}}` character count is `number`
Or {text_column}} character count is or is more than number
etc.

And to be able to select if character count includes spaces or not.

Pablo, if your app is built in google sheets you can do this within the sheets by counting the characters with an arrayformula then having glide just use that number to determine visibility. If greater than 6 then not visible, etc.

2 Likes

I reckon it might be possible in the builder, using the right combination of calculated columns.
I started having a play around with it last night and got very close…

2 Likes

I think I got something here. Not the cleanest solution, but not too bad either. Just takes a little math.

• Here you can see that column 11 has two rows with text in it.
• New Column L has a template with the value of 1 in it.
• New Column J is a template that replaces every letter (and space if you choose) with the number ‘1’. You shouldn’t need to replace any numbers as they are already numbers, but you will probably have to include every letter of the alphabet along with any symbols you would expect to typed in. This makes for a very large set of replacements in a template column.
• Finally, the last column is a math column that determines the number of digits in a number using this formula: `floor(log(n, 10)+1)`

Here is the template column to hold a single digit number, such as ‘1’.

Here is the template column that replaces all characters with a number. I only put in a handful of replacements. You can choose to include spaces or not.

Here is the math column that determines the number of digits in that number.

8 Likes

haha, brilliant!

I knew it would be possible. When I had a go last night, I started off by using a split text column, basically splitting the contents into an array of single characters. The idea I had from there was to somehow use a relation then a rollup to count the number of characters. Which is where I got stuck…

I’m hoping that sooner or later we’ll get some text methods (trim, substring, length, slice, etc) in the data editor. Then this sort of thing will be trivial, and it will open up a whole new world of possibilities

If only we could do `[A-Za-z]*`, or even `[\w]*`

3 Likes

That is exactly the path I started down as well. Discovered I could split without a delimiter and it would split each character, but like you found out, apparently you can’t rollup an array. You can only rollup on rows. Same with the Joined List column. It only works with rows and not an array. I was attempting to do something with math to replace letters with ‘+1’ and create a dynamic math column of some sort, but I guess that’s not possible either. Did some googling and found a formula that works.

I agree, this would be so much easier with wildcards or regex in the template column. Building out all the replacements isn’t horrible, but you definitely wouldn’t want to do it multiple times. I agree, that (trim, substring, length, slice, etc) would help a lot here. I kept trying Len() or Length() in a math column in the hopes that maybe it existed, but we didn’t know about it.

All that math we learned in school, and subsequently forgot because we swore we would never use it in real life…does come into play sometimes. Here’s the info I found on the formula.

5 Likes

Thanks!

However, users can input whatever character they want. I cannot list every single letter, simbol, and unicode.

Any other suggestions?

It would be cool if the glide team extends the formulas that can be used.

length(String)
size(ARRAY COLUMN)

or in general a column type where you can put in your on javascript code to do calculation.

2 Likes

I believe the only practical way to do it now is by using a formula in your Google Sheet.
You could pre-calculate the counts using formulas, and then use these counts in your filtering.

1 Like

So instead of using 1 column in google sheets we revert to 4 columns in glide sheets? Thats sounds like a step backwards if you ask me. We went from an arrayformula with LEN as the simple answer to that.

Yeah, but if you need that count to be reactive in realtime as you’re typing, then it’s quicker because the calculation happens directly on the device, as opposed to the few second delay to sync the data to the glide server, then to the sheet, calculate, then sync back to the glide server, then to the device. I was thinking more of situations for those that might want to display a character count in realtime as they type, or for those that may be using only glide tables and wouldn’t have access to Google sheet formulas, or possibly for user specific columns that will never make it to a google sheet.

I’m always up to the challenge to think outside the box and see what’s possible entirely within glide. I’m sure some of the information may be valuable to somebody someday.

7 Likes

I agree if that is the use cause. But I dont think people would have a immediate use for that unless there is a field that requires a limited count and glide doesnt have fields like that. I guess my thought process was he was using it to identify something that was more static and not changed from moment to moment by the same user.

1 Like

As am I, I wasn’t trying to discount your solution. I just felt like it was overkill. I think we all want to see how far we can push glide and what we can do with it.

1 Like

@Jeff_Hager can you explain me the logic behind it?

2 Likes

Hehe, nope! Found it in a google search. The link I provided above would probably tell you more than I ever could.

1 Like

I have a use case where I need to check that a new password submission contains 6 characters before allowing the submit button to be visible.

Can Glide handle Len () now? I thought it was possible to use Excel formulas now?

I just tried this, but it doesn’t seem to work… any hints?

update: Wow, the formula is picky! I deleted the space in the formula and now it works…

1 Like

You could also use a regular expression with the ‘check text matches’ plugin.

I’m especially concerned if users are creating these usernames and passwords themselves. People too often re-use passwords that they may also use for banking, financial, email, and other important websites. If you are storing credentials like that unprotected, then you are potentially putting all of your users at risk. Finding this data takes very little skill to achieve.

While I do wish that glide would provide a username and password sign in method, I would never recommend attempting to create something yourself.

If I misunderstood what you are attempting to do, then disregard. I just know that you mentioned passwords a couple of times now, which becomes a red flag for me as far as security.

1 Like

Hi Jeff, thanks for the comments. I fully agree. I would never bipass Glide’s sign in and authentication process.

My use case is for an App that hosts a tool that is useful for project owners. Each project owner needs to create their project and then allow other users to join that project. So an owner needs to create a project ID and then a password. Armed with those 2 things other users can search and add themselves to a project. This works since project owners will invite them to use the Glide app and communicate the 2 pieces of info independent of the App.

I don’t know any way to handle this other than letting the User create a project ID code and then a password. My base-plan is to require a 6 figure project ID and then a password also with a minimum number of digits. This should allow me to manage a library of projects with each project having a team that can find a project and add themselves. [A table for logging projects and then a table for logging project members].

The other option I considered was to allow Project owners to manage requests to get access via a user submitting their own details. But honestly, I prefer not to burden project managers with all the requests. I think a project code and password is standard fair, no?

If I’m off-track or doing something risky then let me know!

Regards,
Simon.