Can anyone solve this problem about tag list, bubble sort, firebase, dynamic card view

i did bubble sort and then i just coded get value for every item in the list then when i run it, then it is not coming in an order, the last item in the list is coming in the first. pls help!!



Screenshot 2022-12-30 at 8.02.29 PM
Screenshot 2022-12-30 at 8.02.34 PM

You can use sorting extension or js extension to sort the list or arrays Need list sorter extension - #3 by Still-learning

Or you can try this js method of sorting Correct number order in dictionary - #6 by Still-learning.

Or call the firebase from project ucket it self then segemnt each tav value into list order

Don’t use , call th list then get value method

Call the tag DEPOSITS, sort the result using js then from sorted string parse the values into list then create dynamic view

i didn’t understood, could you please explain by code

Go to fb, export that project bucket as json and upload here… i will try

My firebase structure


Before sorting

After sorting

Total block

JS code

JS code to sort alphanumeric
[_Your_tags_key_should_go_here_].sort((a, b) => a.localeCompare(b, 'en', { numeric: true })).toString()

App response

Got the point now @Gaming ?
Expected like this?

credit to @juananton1991

1 Like

Sure! I’d be happy to help you with your problem involving a tag list, bubble sort, Firebase, and dynamic card view in Kodular. Here is an example of how you might approach this problem:

  1. To create a tag list in Kodular, you can use a List View component. You can populate the list with items from a database or from a list of values that you define in your app.
  2. To sort the items in the list, you can use the bubble sort algorithm. This is a simple sorting algorithm that compares each pair of adjacent items and swaps them if they are in the wrong order. Here is an example of how you might implement bubble sort in Kodular:
// Declare a list of values to sort
list values = ["apple", "banana", "cherry", "date"]

// Implement the bubble sort algorithm
for i from 0 to length(values) - 2
  for j from 0 to length(values) - i - 2
    if values[j] > values[j + 1]
      swap values[j] and values[j + 1]

// Print the sorted list to the console
for value in values

  1. To store and retrieve data from Firebase, you can use the Firebase component in Kodular. You will need to create a Firebase project and set up the necessary authentication keys in your app. Here is an example of how you might use Firebase to save and retrieve data in Kodular:
// Save data to Firebase
firebase.setValue("/users/user1/name", "John")
firebase.setValue("/users/user1/age", 30)

// Retrieve data from Firebase
firebase.getValue("/users/user1/name", function(name) {
  console.log("Name: " + name)
firebase.getValue("/users/user1/age", function(age) {
  console.log("Age: " + age)
  1. To create a dynamic card view in Kodular, you can use a Scroll View component and add a Vertical Arrangement component inside it. You can then add a Card View component inside the Vertical Arrangement and use a for loop to create multiple cards with different content. Here is an example of how you might create a dynamic card view in Kodular:
// Declare a list of card titles
list titles = ["Card 1", "Card 2", "Card 3"]

// Use a for loop to create a card for each title
for title in titles
  // Add a Card View component
  cardView = new CardView(verticalArrangement)
  // Set the card's title
  // Add other content to the card, such as an image or text
  image = new Image(cardView)

I hope this example helps you to solve your problem! If you have any more questions or need further assistance, don’t hesitate to ask.

actually i am new to kodular, so i didn’t understood this complicated code but i am using bubble sort for sorting isn’t it ok?

If it works then no issue… just run for it.