Revamping API Structure for Community User Count in Xano

This meeting involved a discussion among State Changers about enhancing a community-focused application's capabilities. Primarily, there was a need to numerically represent the number of members within each community. The associated data resides in a user table, wherein community details and the member count are present.


To solve the problem, the needed features were implemented using an API for the user community, interacting with their proprietary database. A new query was set up using the filter ID feature to target specific communities, and a "custom query" was adopted with a conditional "where" clause. Although this API appeared to be a promising approach, there were several empty values to consider while conducting the query. While running initial tests, it was determined that an incorrect community ID was used, causing issues in data retrieval. The problem was later examined by rechecking the database for the active community IDs. After adjusting the ID, the next challenge was to return the count instead of the list of users in a community. The team managed this by adjusting the 'return type' from 'list' to 'count' in the output settings of the user query. This returned a simple count of users who are members of a particular community, rather than listing all user details. The ultimate goal was to augment the result from querying all community records with their corresponding member count. After multiple iterations adjusting the query and using features like 'for each loop' and 'add-on', they were finally able to attach the relevant user count to each community. In conclusion, the State Changers effectively implemented a method to retrieve and display the user count for each community within their app. The solution used a combination of API, database querying, and manipulation of return values to achieve the desired result.


(Source: Office Hours 8/23/2023 )

State Change Members Can View The Video Here
chris-montgomery-smgTvepind4-unsplash.jpg

View This Video Now

Join State Change Risk-Free