Joining a variable to a URL?

Im making an app in which you enter a college basketball player's jersey number and it shows you the stats of that player. I have a spreadsheet with all the players' jersey numbers and their names. Their names are formatted in a way that they can be placed at the end of the website's URL and it'll be the correct link (ex: stats.com/playerstats/[player-name]) I've successfully made the part where the user enters the jersey number and the name of the player is returned. I stored the player name in a variable and made it persist through screens using TinyDB. However, when I try and join the URL and variable, it brings me to a 404 page. What am I doing wrong?


Can you see the red error marker on your TinyDB.GetValue block?
Don't use that block during initialization, you could do for example


without need to use a variable

Use the companion app and Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

The guy in the tutorial had the same error and it worked for him so I thought it would work for me. I tried your method and it just gave me the same results.

It would really help if you provided an updated screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Now use Do it to find out the complete url


Taifun

I didn't know you could do that, that's very helpful! It looks like the URL is coming out with the variable in quotes and brackets. (url. com/players/["playername"]) I'm assuming I need to trim off the quotes and brackets, but I'm not sure which block I need to use or where to put it

You have saved the playername in a list. Use the select item from list block with index 1.

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