Search And Data Processing

Calculating Unique Pairings | A Xano Build Project with Shenal Harakh

Summary

As a Customer Success Associate at Xano, Shanel Haruk recently embarked on a thrilling journey – building a calculator to determine the number of unique pairs that can be formed from a given set of items. But this wasn't just an ordinary project; it was an opportunity to dive deep into the world of no-code development and experience firsthand the power of Xano's visual interface.

In this article, we'll walk you through Shanel's thought process, her approach to breaking down the problem, and the valuable lessons she learned along the way. Whether you're a no-code enthusiast, a citizen developer, a seasoned programmer, or an entrepreneur seeking to bring your ideas to life, this guide will provide you with practical insights and step-by-step instructions to help you harness the full potential of Xano.

The Challenge: Calculating Unique Pairs

Shanel's goal was to build a calculator that could determine the number of unique pairs that can be formed from a given set of items. To make it more relatable, she used the example of organizing a tennis tournament for the top 10 men's players in the world. The first step was to calculate the number of matches required if each player were to play against every other player once.

To solve this problem, Shanel drew upon her knowledge from high school mathematics – the concept of combinations and permutations. She remembered the formula for calculating the number of unique combinations of items taken from a set:

nCr = n! / (r! * (n - r)!)

Here, `n` represents the total number of items in the set, and `r` represents the number of items to be chosen from the set. In the case of the tennis tournament, `n` would be 10 (the number of players), and `r` would be 2 (since we're interested in pairs).

Breaking Down the Problem

Shanel recognized that she needed to translate this mathematical formula into a series of steps that could be executed within Xano's visual interface. She broke down the problem into two key components:

  1. Functions: Identify the transformations or operations required by the formula.
  2. Dynamic Values: Determine the values or numbers that need to be transformed or manipulated.

For the numerator of the formula (`n!`), Shanel noticed a pattern: it involved multiplying the input value (`n`) by every number smaller than itself, down to 1. She expressed this pattern as:

n * (n - 0) * (n - 1) * (n - 2) * ... * 1

In this expression, the dynamic value is `n` (the number of tennis players), and the function is subtracting an index value from `n` and multiplying the results together.

Translating the Problem into Xano

With the problem broken down into its constituent parts, Shanel was ready to translate it into Xano's visual interface. Here's how she approached it:

  1. Create an Array: Since the formula involved operating on a list of items (the tennis players), Shanel knew she needed to create an array in Xano.
  2. Use a For-Each Loop: To perform an operation on each item in the array, Shanel utilized a for-each loop. This allowed her to subtract the index value from the input value (`n`) for each item in the array.
  3. Apply a Math Filter: Within the for-each loop, Shanel used a math filter to perform the subtraction operation (`n - index`).
  4. Find the Product of the Array: After obtaining the subtracted values, Shanel needed to multiply them together. For this, she used Xano's built-in function to find the product of an array.

By breaking down the problem into smaller, manageable steps and translating them into Xano's visual interface, Shanel was able to successfully build her calculator.

The Power of Variables

One of the most significant lessons Shanel learned during her build project was the importance of creating and updating variables in Xano. Initially, she struggled to understand the concept of variables, thinking of them as mere containers of information.

However, Shanel soon realized that variables in Xano are much more powerful than that. They allow you to conceptually build onto existing data structures without affecting the original records until you explicitly save the changes to the database.

Shanel likened variables in Xano to extending a home. Instead of immediately building additional rooms and creating new relationships with the existing structure, variables enable you to conceptually plan and define your business logic without modifying the original data.

This approach not only saves storage space but also provides flexibility in managing and manipulating data within Xano's visual interface.

Conclusion

Shanel's journey with Xano has been a rewarding one, filled with valuable lessons and insights. By breaking down complex problems into smaller, manageable steps and translating them into Xano's visual interface, she was able to build a powerful calculator without writing a single line of code.

The power of variables in Xano also played a crucial role, enabling Shanel to conceptually build upon existing data structures and define her business logic without modifying the original records.

Whether you're a no-code enthusiast, a citizen developer, a traditional developer, or an entrepreneur, Xano's visual interface and intuitive approach to backend development can empower you to bring your ideas to life with ease and efficiency.

So, what are you waiting for? Dive into the world of no-code development with Xano and unlock new possibilities for your applications. And if you ever get stuck or need guidance, remember that the Xano community and support team are always there to lend a helping hand.

This transcript was AI generated to allow users to quickly answer technical questions about Xano.

Was this helpful?

I found it helpful

I need more support
Sign up for XanoSign up for Xano

Build without limits on a secure, scalable backend.

Unblock your team's progress and create a backend that will scale for free.

Start building for free