Don't Fear AI; Let It Empower You!
In a world where "AI taking over jobs" headlines buzz around us like persistent flies, it's easy to miss the beat of progress and innovation that this technology promises. If you're anxious about artificial intelligence edging into your workspace, let me offer a different perspective: AI won't snatch your job; instead, you can use it to elevate your performance and save you invaluable time.
Read this Formula and tell me you understand it
It's real formula taken from a Power App one of the Collab365 team has been working on (check out the Poker App build in the Academy if you are intrigued). It has a role to play in a poker game in controlling a timer. But what does it do? You can get all Power Apps Poker Build Episodes as part of your Collab365 Academy Subscription.
If(First(galTablePlayers.AllItems).UniqueID=varCurrentUser.UniqueID,If((CountRows(galTablePlayers.AllItems)>1&&LookUp(PokerHands,Table.UniqueID=varSelectedTable.UniqueID).PlayerTurn=0)||(DateDiff(LookUp(PokerHands,Table.UniqueID=varSelectedTable.UniqueID).CurrentTurnTime,Now(),TimeUnit.Seconds)>10&&LookUp(PokerHands,Table.UniqueID=varSelectedTable.UniqueID).PlayerTurn>0),Patch(PokerHands,LookUp(PokerHands,Table.UniqueID=varSelectedTable.UniqueID),{PlayerTurn:LookUp(PokerHands,Table.UniqueID=varSelectedTable.UniqueID).PlayerTurn+1,CurrentTurnTime:Now()})));
Confused? You're not alone.
As someone who regularly looks at other peoples formulas in Power Apps to try to help them, this scenario is not uncommon.
Say I have just inherited an App from a person who is leaving the team. What do I do if I need to explain, fix or change something ?
What about if someone asks me for advice about the design of their App and presents me with this function?
In the blink of an eye I can tell I'm in trouble here. Thankfully though, although it may look like gibberish at first glance, with the help of AI, we can unlock its secrets.
AI to the Rescue!
Try this. You'll be surprised. Reach for your favourite AI companion. I use Windows Copilot as much as I do Open AI ChatGPT directly now. Here's the prompt I wrote:
Describe what's going on in this power app formula. Make the explanation suitable for a 4 year old to understand. Break each point you make into bullet points. Give an overall summary then describe the flow of the logic in simple terms in the bullet points
Here's what I got back:
Sure, let’s imagine this formula as a game of musical chairs. Here’s a simple explanation:
- Summary: The formula is like a referee in a game of musical chairs, ensuring it's your turn and then passing the turn to the next player.
Now, let’s break it down:
- First Check: The formula first checks if you are the first player in the game. It’s like checking if you’re the one who starts the music in our game of musical chairs.
- Second Check: If you are the first player, the formula then checks two things:
- More than one player: It checks if there are more than one players in the game and if it’s the start of the game (no one has had their turn yet). It’s like checking if there are enough players for the game and if the music hasn’t started yet.
- Player’s turn time: It also checks if the current player’s turn has lasted more than 10 seconds. It’s like checking if a player has been out of their chair for too long.
- Update Turn: If either of the above conditions is true, the formula updates the game to the next player’s turn and records the current time. It’s like stopping the music and moving to the next player.
So, this formula is like the rules of a game of musical chairs, making sure everyone gets a turn and no one stays out of their chair for too long! 🎵🪑
Mind Blown?
Yeah, again, me too. In essence, this AI explanation transforms a complex formula into the rules of a game of musical chairs.
But heres the REAL golden ticket to success. I then asked it a second question (AI has 'memory' and can hold much more data about your conversation that it has been able to previously). Here's what I asked in the same chat thread.
Is there a simpler way to execute this same set of logic in a power app formula?
The result:
Yes, the formula can be simplified by creating a variable for the repeated lookup operation and using it in the formula. Here’s how you can do it:
Set(varCurrentPokerHand, LookUp(PokerHands, Table.UniqueID = varSelectedTable.UniqueID));
If(
First(galTablePlayers.AllItems).UniqueID = varCurrentUser.UniqueID,
If(
(CountRows(galTablePlayers.AllItems) > 1 && varCurrentPokerHand.PlayerTurn = 0) ||
(DateDiff(varCurrentPokerHand.CurrentTurnTime, Now(), TimeUnit.Seconds) > 10 && varCurrentPokerHand.PlayerTurn > 0),
Patch(
PokerHands,
varCurrentPokerHand,
{PlayerTurn: varCurrentPokerHand.PlayerTurn + 1, CurrentTurnTime: Now()}
)
)
);
This version of the formula does the same thing as the original, but it’s easier to read because it avoids doing the same lookup operation multiple times. It’s like having a helper who remembers the current state of the game, so you don’t have to keep checking it yourself! 🧑🔧
So What Now?
For me at least, I'm going to do this more. As a technique, it's not only great for illuminating the complex, but also for documenting what you have created.
Sure, AI will sometimes give me the wrong answer but that's where my own knowledge can be used as safety net. I'm not asking AI to create new ideas, just give me a supportive hand to help break an existing problem down and describe it in plain language. And truth be told its done a pretty good job.
This is where AI can be a valuable tool right now to overcome what once might have been a complex problem I would have shied away from. Now, we can get the gist and not waste time scratching our head over a complex piece of formula.
Your Turn to Test
Give AI a shot on something you're familiar with to gauge its effectiveness. Once comfortable, apply this method when you're baffled by a formula or when you want to craft one from simple English instructions.
We're curious to hear about your experiences! Share your stories with us in the academy and discover how AI can be your job's ally, not its replacement.