Displaying first letter of a database text field

Hey everyone!

I am building an app for a client and have been able to do almost everything. Funny enough, something that seems like it should be quite simple is turning into a bit of a headache.

In the app, users have profiles. Their profile name should be displayed as “First Name” “Last Name Initial” so for me it would be “John K”.

I’ve explored a bunch of different options from messing with display settings to creating fields in the database, but nothing seems to be working right.

If anyone has any insight of how I could accomplish this it would be greatly appreciated.

Hey there @JohnKrueger

Welcome to the community :sunglasses:

It’s possible to do this using Pragmaflow’s arbitrary javascript if you know a little bit of javascript. Here’s the link: PragmaFlow Adalo Toolkit

The idea is that after the user has submitted the first name and last name, you would uppercase the last name string, keep the first letter only, then save that to a new user text parameter like “last name initial”

2 Likes

Interesting! I don’t know any javascript but maybe I can figure it out. Thanks!

In terms of connecting my app to this, since this is external, would the user information still be secure?

This is all internal, nothing done externally. That’s the beauty of this plugin, the javascript lives on the screen where you put the component.

This was the video I first watched that showed me that you can do javascript to inputs to create new results: https://vimeo.com/user137874864?embedded=true&source=owner_name&owner=137874864

3 Likes

Made a video of how you can do this with the Arbitrary Javascript component! ( This includes voice too! I’m so happy today because I got my mic that I now can make videos with voice :partying_face: ) : Loom | Free Screen & Video Recording Software

How to download the Arbitrary Javascript component : PragmaFlow's Adalo Marketplace Reopened - YouTube

Flawless also did a tutorial about how to download ( both are same! ) : 🧙‍♂️ How to install the Arbitrary Javascript by Pragmaflow into your Adalo app

Script :

var first_name = "John";
var first_name_in_capital = first_name.charAt(0).toUpperCase() + first_name.slice(1);
var last_name = "krueger";
var last_name_in_capital = last_name.charAt(0).toUpperCase();
var Name = first_name_in_capital + "." + last_name_in_capital;
return Name;

( replace the John and krueger with magic text )

You can do this with API’s too : Custom function to return the first character of a word - #5 by dilon_perera

Thank you

2 Likes

Perfect job! This also solves my problems because I used AbracAdalo for string manipulation which makes the app super slow! Now I can do everything locally without an API call!

2 Likes

Wow, this is awesome! Thank you so much Dilon :slight_smile: I will try it right.

Update: Worked like a charm, thanks!

1 Like

I will start digging here as well to level up that skill set. Thanks for the help!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.