SAP Builders Discussions
Join the discussion -- ask questions and discuss how you and fellow SAP Builders are using SAP Build, SAP Build Apps, SAP Build Process Automation, and SAP Build Work Zone.
cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Build Challenge – Week 1 – Formulas

Dan_Wroblewski
Developer Advocate
Developer Advocate
36,495

This post is part of the SAP Build Community Challenge (April 2023)

dan_wroblewski_0-1680162815071.png

This week’s challenge involves formulas – a key feature of SAP Build Apps. Formulas are used in bindings of components, and enable you to manipulate data before it is displayed in a component or before it is sent to a data source.

dan_wroblewski_0-1680162183899.png

Formulas are created in the formula editor, which provides some tools for making writing formulas easier:

  • It has a list of functions, which can be added to the formula with a click.
  • It has documentation on each function, plus examples.
  • It has a live testing of functions so you can be certain how they work.
  • It checks the syntax of the formula.
  • It shows an expected sample result of the function.
  • It checks the resulting data type against the data type expected by the component or flow function using the formula.

Here are some learning materials about formulas:

 

Setup

We will give you an app that looks like this (I like cats).

dan_wroblewski_0-1680161844555.png

To set up the challenge, do the following:

  1. Download the skeleton project called Challenge - Formulas.zip.gpg.
  2. Create a new SAP Build Apps project in your tenant or the sandbox.
  3. Import the downloaded file into your new project by selecting History > Replace in the top-right corner, and then selecting the downloaded project. 

dan_wroblewski_1-1680205193965.png

You should now have the skeleton project.

dan_wroblewski_0-1680205123196.png

Inside the app, we have already created a page variable called StartValue that contains the starting data that we want you to transform. 

 

The Challenge

When you are ready, on the UI Canvas, select the Transform button, open the logic canvas, then select the Set page variable flow function, and finally go to set the formula for Assigned Value on the right (which currently returns an empty list).

dan_wroblewski_3-1680160487847.png

This is what you need to do:

  1. Write a formula that replaces the empty list for the assigned value and that does the following:
    • Aggregates the data from StartValue so that in EndValue each name appears only once with an average calculated from the amount fields.
    • Names should be sorted alphabetically, from A to Z
    • Averages should be rounded to the nearest integer.
  2. Launch your app.
  3. Click the Transform button (which will display 4 names and an average for each), and then type your name in the input field.
  4. Take a screenshot and post it to THIS discussion.
    • BONUS: Add to your entry the movie from where the 4 names in the results are taken.

Your screenshot should look something like this but without the blur (I need to see the names and averages) and with your name:

dan_wroblewski_1-1680162021890.png

Good luck ... and have fun!!

 

Hint

You have to do 3 things in the formula (aggregate/group, sort, round), so find a function that does each one. Use the wonderful editor features that document the available functions.

For example, for aggregating, go to the List area, and then find a function that aggregates (in this case, GROUP). You'll see all the documentation for it on the right, plus a little playground inside the documentation for testing it. Pretty cool! 

 dan_wroblewski_0-1680588176659.png




--------------
See all my blogs and connect with me on Twitter / LinkedIn
176 REPLIES 176

0 Kudos
7,440

Glad you liked it!! 🧩🎈




--------------
See all my blogs and connect with me on Twitter / LinkedIn

javiermartin02
Product and Topic Expert
Product and Topic Expert
7,384

Sorry, I couldn't help it.

Movie name: Madagascar

Thanks for the challenge!

ezgif-4-8a83544288.gif

0 Kudos
5,392

You transformed ... MY KITTY!!!!!!! He used to be so grumpy and look at him now!




--------------
See all my blogs and connect with me on Twitter / LinkedIn

5,386

Sorry but it practiced with some SAP Build challenges and look at him now 🙂

NoeJC
Explorer
5,387

Hi Dan,

noe_jimenez_0-1680617661507.png

Movie: Madagascar

Great challenge! First time on SAP Build and I enjoyed it playing with Formulas.

5,382

Hi Dan, 

Movie is Madagascar.

SLEYSEN_0-1680619087944.png

Nice challenge! 

 

samuelesalines
Explorer
5,380

Hello everyone!
Here's my answer!

Movie: Madagascar 😎

samuelesalines_0-1680619691517.png

 

filippocapecci
Newcomer
5,371

Hello everyone!

Movie: Madagascar

Cattura.PNG

nabheetscn
Active Contributor
5,371

Here you go Dan.  Thanks for the challenge it helped me restart my learning journey.

nabheetscn_0-1680631623342.png

 

0 Kudos
5,149

Glad you liked this and it helped you 😺




--------------
See all my blogs and connect with me on Twitter / LinkedIn

evra83
Explorer
5,345

Hi Dan, 

Thanks you for this challenge

Challenge 01.jpeg

Thierry
Advisor
Advisor
5,339

Hi Dan,

Thank you for the cool challenge 🙂

Thierry_0-1680715740623.png

 

JesseSukhbayar
Product and Topic Expert
Product and Topic Expert
5,322

Thanks to @Kanishka for help on this! 😊

jesse0908_0-1680791572366.png

 

0 Kudos
5,163

The numbers are not exact and the list is not sorted by the name ... do you want to share your formula?

Also, most everyone else has their name in red ... what happened here?




--------------
See all my blogs and connect with me on Twitter / LinkedIn

vishalakshmi
Contributor
5,318

Challenge was accepted and completed! Looking forward to the next challenge.

vishalakshmi_0-1680823337206.png

Thanks,

Vishalakshmi Namuduri

KarthickD
Participant
5,303

Hi @Dan_Wroblewski ,
Thanks for that Challenge!!
Here is my screen shot form web and Mobile App
I really don't know the movie name...just got to know from the comments.

KarthickD_0-1680856338839.png

KarthickD_2-1680856468476.jpeg

 

 

0 Kudos
5,182

I get 97 for Marty ... want to share your formula?




--------------
See all my blogs and connect with me on Twitter / LinkedIn

5,013

Hi @Dan_Wroblewski ,
I have mistakenly used "CEIL" Function instead of "ROUND".

Suneel
Explorer
5,311

Thanks for the challenge. I learnt something new. 🙂

Suneel_0-1680867181636.png

movie_Name: ["Madagascar 1", "Madagascar 2", "Madagascar 3"]

movie_Name[0]: "Madagascar 1"

Note; consider including "the Self Proclaimed Illustrious King in your test data. His Royal Highness King Julien.😃

0 Kudos
5,201

I prefer the deadpan sidekick Maurice




--------------
See all my blogs and connect with me on Twitter / LinkedIn

cwitschel
Explorer
5,310

Hi all, enjoyed this first challenge.
The names are from the movie Madagascar

F21F539B-731E-4659-BF32-278662325B03.jpeg

 

gphadnis2000
Participant
5,301

Hi Dan,

 

Enjoyed the first Challenge.

The names from the movie Madagascar.

gphadnis2000_0-1680877357485.png

Thanks,

Gaurav Phadnis

GizemSoyluu
Explorer
5,305

Hello,
Thank you for this challenge!
The movie is Madagascar 😍
gizemsoylu_0-1680896050952.png

 

0 Kudos
5,216

Like the dark theme!!




--------------
See all my blogs and connect with me on Twitter / LinkedIn

Badar_MD
Explorer
5,301

Thanks! Looks fun and interesting!

ManojSutar
Explorer
5,274

Movie Madagascar

ManojSutar_0-1680956258764.png

 

ADR
Participant
5,270

Thanks Dan for the challenge. Looking forward to the next one. 

SAP Build Challenge 1.JPG

JJAIMES
Participant
5,262

Hi @Dan_Wroblewski ,

it was worth it.

Thanks 

 

01_fisrt_challenge.jpg

 



 


 

0 Kudos
5,232

Nice work, and thanks for the video. It is not quite displaying properly in the post -- maybe make the screenshot smaller and put video on new line. I'm new to the Groups interface, too 🙂




--------------
See all my blogs and connect with me on Twitter / LinkedIn

SUNIL_JOHN
Participant
5,254

IMG_0003.png

 

Looking forward for next week! 

0 Kudos
5,237

No idea about the movie 😺 ?




--------------
See all my blogs and connect with me on Twitter / LinkedIn

0 Kudos
5,213

I get 97 for Marty. Interested, a few others got 98. Want to share your formula?




--------------
See all my blogs and connect with me on Twitter / LinkedIn

Dpacheco
Explorer
5,259

Hi, thanks for the opportunity and better late than never!!!

Movie: Madagascar

Dpacheco_0-1681006153027.png

See you in the next one!!!

0 Kudos
5,247

Not late at all -- you have until May 7 to do all of them.

P.S.: There is a Claudia Pacheco who works with me here at SAP. Related?




--------------
See all my blogs and connect with me on Twitter / LinkedIn

0 Kudos
5,185

I don't think so, but who knows maybe some kind of distant cousin 🙂 

aaruljothi
Participant
5,145

Hi all,

My answer below:

Movie: Madagascar

aaruljothi_0-1681127289439.png

 

rohit_kadam
Discoverer
5,147

Hi Dan,

Thanks for the Challenge.

rohit_kadam_0-1681129256877.png

🎬Madagascar 

PranayaBhanja
Discoverer
5,141

Hi Dan.

Here is the Screenshot.

Thanks for the challenge!!

PranayaBhanja_0-1681135706102.png

 

5,140

Hi Dan, great challenge!

Movie: Madagascar 😉

SofiaBastos_0-1681141429720.png

Thank you! Looking forward for the next one! 

0 Kudos
5,093

Glad you participated.

Second one already out 😺

https://blogs.sap.com/2023/03/30/you-think-you-know-sap-build-take-our-challenge/

https://youtu.be/uq2wJNqygkU

😺




--------------
See all my blogs and connect with me on Twitter / LinkedIn