Leaderboard and uploaded image

Hi everyone, I desperately need your help to solve a problem that’s driving me crazy.

I’m developing a game with App Inventor which would make it possible to upload an image from our device, combining it with our name on the leaderboard. That is, the high scores appear on a listview, and if you press on a name, the image uploaded by the gamer appears.

To do so, first I used Pictodrive extension to upload an image from my device into a database folder. Then I add the image id to the gamer name, namely I make a junction of two texts and I save them as single tag on Firebase.

But when I try to apply the list sorting to make the ranking, I get an error saying that its not possible to perform such operation with the image id included, probably because such id contains both letters and numbers.

At this point I don’t know what to do, so I hope some of you could help me.

Please provide a more detailed explanation of what you are trying to achieve, what you have done so far, what works, what doesn’t work…


Please show your relevant blocks, or screenshots of the Designer screen or app in action, and examples of your lists, so we can see what you are trying to do
Right Click in Blocks Editor and select “Download Blocks as Image” for the best image of your blocks. (use image editor to crop etc. if required)

Be sure to use text comparison instead of numeric comparison in your sort.

Ok, I’ll describe step by step what I did:

  1. First of all, I insert the name in a label, and pick an image which I upload in a database folder with Pictodrive, then I save name and image id in TinyDB.

  2. After the game, I save on Firebase the score as value, and the union of name and image id as tag.

  3. I make the leaderboard with the high scores ranking, and at this point already appearing the error, namely the image id is indicated as “bad argument”, it can’t be included in the sorting algorithm. But if I insert, as tag, only the name (without numbers or special characters), then it’s all right, and I can make the leaderboard.

What can I do?

You don’t show the list of items you are trying to sort?
My guess is you are trying to sort numbers when you actually have strings (text) with a number in them.

You can still sort by text, but if your string starts with a number you will need to ensure that there are leading zeros in the right places, so: for 1,10,100 use 001, 010,100 and this will sort in that order.

The problem is that the image id is random, therefore the strings could begins both with a letter and with a number.

An example of list to sorting could be like that:

45____Robert____Qw6yJsA71Zx

67____Theodore____9kMaZxp5t

31____Jane____urY1b45Vo7z

53____Alan____Hg0czD14Fi

This would be the final result on the listview:

1:____0067____Theodore

2:____0053____Alan

3:____0045____Robert

4:____0031____Jane

And the image id will be used to visualize the uploaded image of the gamer in another context.

As I suggested, sort by TEXT not by NUMBER, ensuring you cover off the largest number by using leading zeros

IT WORKS! Thank you so much! :wink: