Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP Build Challenge – Week 1 – Formulas

Dan_Wroblewski
Developer Advocate
Developer Advocate
44,682

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
Read only

0 Kudos
9,306

Glad you liked it!! 🧩🎈




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

javiermartin02
Product and Topic Expert
Product and Topic Expert
9,250

Sorry, I couldn't help it.

Movie name: Madagascar

Thanks for the challenge!

ezgif-4-8a83544288.gif

Read only

0 Kudos
7,258

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
Read only

7,252

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

Read only

NoeJC
Explorer
7,253

Hi Dan,

noe_jimenez_0-1680617661507.png

Movie: Madagascar

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

Read only

7,248

Hi Dan, 

Movie is Madagascar.

SLEYSEN_0-1680619087944.png

Nice challenge! 

 

Read only

samuelesalines99
Explorer
7,246

Hello everyone!
Here's my answer!

Movie: Madagascar 😎

samuelesalines_0-1680619691517.png

 

Read only

filippocapecci
Newcomer
7,237

Hello everyone!

Movie: Madagascar

Cattura.PNG

Read only

nabheetscn
SAP Champion
SAP Champion
7,237

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

nabheetscn_0-1680631623342.png

 

Read only

0 Kudos
7,015

Glad you liked this and it helped you 😺




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

evra83
Explorer
7,211

Hi Dan, 

Thanks you for this challenge

Challenge 01.jpeg

Read only

Thierry
Product and Topic Expert
Product and Topic Expert
7,205

Hi Dan,

Thank you for the cool challenge 🙂

Thierry_0-1680715740623.png

 

Read only

JesseSukhbayar
Product and Topic Expert
Product and Topic Expert
7,188

Thanks to @Kanishka for help on this! 😊

jesse0908_0-1680791572366.png

 

Read only

0 Kudos
7,029

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
Read only

vishalakshmi
Contributor
7,184

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

vishalakshmi_0-1680823337206.png

Thanks,

Vishalakshmi Namuduri
Read only

KarthickD
Participant
7,169

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

 

 

Read only

0 Kudos
7,048

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




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

6,879

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

Read only

Suneel
Explorer
7,177

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.😃

Read only

0 Kudos
7,067

I prefer the deadpan sidekick Maurice




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

cwitschel
Explorer
7,176

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

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

 

Read only

gphadnis2000
Participant
7,167

Hi Dan,

 

Enjoyed the first Challenge.

The names from the movie Madagascar.

gphadnis2000_0-1680877357485.png

Thanks,

Gaurav Phadnis

Read only

GizemSoyluu
Explorer
7,171

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

 

Read only

0 Kudos
7,082

Like the dark theme!!




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

Badar_MD
Explorer
7,167

Thanks! Looks fun and interesting!

Read only

ManojSutar
Explorer
7,140

Movie Madagascar

ManojSutar_0-1680956258764.png

 

Read only

ADR
Participant
7,136

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

SAP Build Challenge 1.JPG

Read only

JJAIMES
Participant
7,128

Hi @Dan_Wroblewski ,

it was worth it.

Thanks 

 

01_fisrt_challenge.jpg

 



 


 

Read only

0 Kudos
7,098

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
Read only

SUNIL_JOHN
Participant
7,120

IMG_0003.png

 

Looking forward for next week! 

Read only

0 Kudos
7,103

No idea about the movie 😺 ?




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

0 Kudos
7,079

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
Read only

Dpacheco
Explorer
7,125

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

Movie: Madagascar

Dpacheco_0-1681006153027.png

See you in the next one!!!

Read only

0 Kudos
7,113

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
Read only

0 Kudos
7,051

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

Read only

aaruljothi
Participant
7,011

Hi all,

My answer below:

Movie: Madagascar

aaruljothi_0-1681127289439.png

 

Read only

rohit_kadam
Discoverer
7,013

Hi Dan,

Thanks for the Challenge.

rohit_kadam_0-1681129256877.png

🎬Madagascar 

Read only

PranayaBhanja
Discoverer
7,007

Hi Dan.

Here is the Screenshot.

Thanks for the challenge!!

PranayaBhanja_0-1681135706102.png

 

Read only

7,006

Hi Dan, great challenge!

Movie: Madagascar 😉

SofiaBastos_0-1681141429720.png

Thank you! Looking forward for the next one! 

Read only

0 Kudos
6,959

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