Sorting list by most

I’m trying to sort a field from data coming from Firestore rest api by most recent, but the results appear randomly. Is there a solution?
this is a part of when got text block.

Hwy dont you use extension? else show us your returned json data to help further

1 Like

I tried yes two extensions (Advanced List Manipulation and ListUtilz) but did not worked too..
maybe I do not know the correct way to use them to do this role..
this is the returned json..

Hi Basem,

You could try this setup,

responseContent

{
	"joinRequests": {
		"mapValue": {
			"fields": {
				"110KoxcEkS13": {
					"mapValue": {
						"fields": {
							"username": {
								"stringValue": "mario"
							},
							"time": {
								"integerValue": "6"
							}
						}
					}
				},
				"dvs110KodsvsdDSVDsvSD": {
					"mapValue": {
						"fields": {
							"username": {
								"stringValue": "elena"
							},
							"time": {
								"integerValue": "3433"
							}
						}
					}
				},
				"bdfbafbae43y5": {
					"mapValue": {
						"fields": {
							"username": {
								"stringValue": "assunta"
							},
							"time": {
								"integerValue": "1757"
							}
						}
					}
				},
				"ab434dsvsdvsdv13": {
					"mapValue": {
						"fields": {
							"username": {
								"stringValue": "gervaso"
							},
							"time": {
								"integerValue": "6477"
							}
						}
					}
				}
			}
		}
	}
}

Result

Hi RaYzZz,
I tried your setup it works when I cut the joinRequests part but in the full response it does not work..
If you have time, could you please send me the full block of when got text?
I think that will solve the problem..
I will attach the full response on txt and screens



full response.txt (1.2 KB)

I modified and hid the old txt files you had published because they contained the information you had covered.

immagine
immagine

Anyway, I see that the JSON in the txt is not identical to the images and it doesn’t turn out to be a properly formatted JSON.
If you can, send the correct JSON, in the meantime, I’ll try to fix it.

I corrected the JSON file and this is how it looks now

JSON
{
	"name": "projects/projectID/databases/(default)/documents/posts/MTA6uSDMvRMIkcIWLMBJ",
	"fields": {
		"pubname": {
			"stringValue": "mohader"
		},
		"timestamp": {
			"integerValue": "1757690184066"
		},
		"joinRequests": {
			"mapValue": {
				"fields": {
					"l10KoxcEk70pvShvMUOmJ0VJMS13": {
						"mapValue": {
							"fields": {
								"username": {
									"stringValue": "workay"
								},
								"time": {
									"integerValue": "1757691255506"
								}
							}
						}
					},
					"qk4sUkj1edZsAmBnuEWRbsj7PJy1": {
						"mapValue": {
							"fields": {
								"time": {
									"integerValue": "1757691381093"
								},
								"username": {
									"stringValue": "ghy"
								}
							}
						}
					},
					"SrVeXjD9RAaawFy46jjlwsBHlgS2": {
						"mapValue": {
							"fields": {
								"username": {
									"stringValue": "basem92"
								},
								"time": {
									"integerValue": "1757691353430"
								}
							}
						}
					}
				}
			}
		},
		"members": {
			"arrayValue": {
				"values": [
					{
						"stringValue": "W2V1AfWD1VXnidmmFddXX9pVQuJ2"
					}
				]
			}
		},
		"userId": {
			"stringValue": "W2V1AfWD1VXnidmmFddXX9pVQuJ2"
		},
		"description": {
			"stringValue": "allah"
		},
		"chatId": {
			"stringValue": ""
		}
	},
	"createTime": "2025-09-12T15:16:26.020837Z",
	"updateTime": "2025-09-12T15:36:22.140346Z"
}

For the blocks, I simply added fields to get value at key path.

Now it is working thank you..
I have now another small problem .. when I display them in a listview it is fine, but when I display them in dynamic components, they appear duplicated. How do I solve this?

Very good :partying_face:

place this part of the blocks outside the for each key.

2 Likes

worked 100%
thanks pro :raising_hands: :clap:

2 Likes