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
43,340

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
6,956

Nice data, I just can't check if the function is correct and does what it is supposed to do 😺 




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

6,942

You’re right, as soon as I can, I’ll publish the one with the correct data.

Sorry!!

Read only

hismail
Discoverer
7,097

Hi Dan,

Thanks for the interesting challenge.

Movie: Madagascar

 

Challenge 1 - Hesham Ismail.jpg

 

Read only

dinah
Product and Topic Expert
Product and Topic Expert
7,119

My Output:

dinah_0-1681996290880.png

 

Read only

0 Kudos
7,063

Nice work 😺 Feel free to do the other challenges

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




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

Pamela
Product and Topic Expert
Product and Topic Expert
7,118

Hello Dan,

Thanks for the interesting challenge. 

Just discovered this challenge yesterday, hoping it's not too late to joing it.

Here is my screenshot:

Pamela_0-1682045257418.png

thanks,

Pamela

Read only

0 Kudos
7,068

Of course not too late 😺Please participate in all the challenges

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




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

Sai_Nithesh_G
Active Participant
7,120

Hello Dan,

Movie name : Madagascar

Challenge is very interesting. I was trying this quite long time. After going through the steps and suggestions from the comments multiple times, I have achieved finally. 😎

sainithesh_0-1682172248214.png

 

Read only

0 Kudos
7,084

Sorry it took a long time ... what was particularly difficult?

Try the other challenges 😺

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




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

7,058

Actually, It took more time for me to identify that I have to use PLUCK to get amount values from the items loop.

Anyhow its a good learning 😀

Read only

rajkumar
Explorer
7,183

 

rajkumar_0-1682187625427.png

 

Read only

0 Kudos
7,095

Nice work...I hope you will try the other challenges

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




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

HelenaFortun
Explorer
7,180

Hello Dan,

I started a bit late with the challenge.... I like such tasks!!! 

Here my first part:

Screenshot_20230422_233739_SAP Build Apps.jpg

The movie is Madagascar!

Best regards!

Helena

Read only

0 Kudos
7,110

Thanks for participating and glad you liked it. You left out the sorting part.

After adding the sorting, try out the other challenges ... never too late 😺

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




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

vinay050
Participant
7,179

Hello @Dan_Wroblewski ,

Really enjoyed working on this challenge. 

Move name is Madagascar and following is the screenshot of my app 

vinay050_0-1682213676572.png

Regards

Vinay

Read only

rsraj
Explorer
7,200

Hello Dan,

Here's my first week challenge. Thank you very much!

Challenge1.PNG

Read only

0 Kudos
7,118

Thanks for joining the challenge 😺 Please consider continuing onto the rest

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




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

shridharshetty
Explorer
7,210

Thanks for the Build Challenge.

Movie name: Madagascar.

Week 1.png

Read only

0 Kudos
7,160

Great job ... thanks for participating 😺




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

mrpz
Explorer
7,191

Hello,

Starting at full speed the challenge this week! 🙂 

The Key is to work with the appgyver doc webpage.

mrpz_0-1682363729421.png

 

Read only

Dan_Wroblewski
Developer Advocate
Developer Advocate
0 Kudos
7,174

Nothing better than good documentation 😺




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

jakku
Explorer
7,179

Great Challenge, Below is my screenshot.

 

Screenshot 2023-04-25 155310.png

Read only

0 Kudos
7,175

Thanks for participating ... please enjoy the others 😺




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

Alejandro1
Product and Topic Expert
Product and Topic Expert
7,122

Hello @Dan_Wroblewski,

SAP Build Challenge – Week 1 – Formulas:
Alejandro1_0-1682493244665.png

Looking forward for more exercises like this one to get familiar with the Formulas of SAP Build Apps!!

Thank you 🙂

 

Read only

0 Kudos
7,069

Perhaps we could continue with a regular (weekly, monthly) challenge related to formulas ... we'll see 😺 




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

CarlGP
Newcomer
7,117

Hi Dan,

I just found out about these Challenges today, and it took a while to get the hang of the formulas. But I now finally got the result below  😀. Thanks!

CarlGP_0-1682506360561.png

 

Read only

0 Kudos
7,078

I'm glad you finally found them 😺 Please participate in the others also




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

staseeb
Active Participant
7,105

Hello @Dan_Wroblewski ,

Thank you for this challenge! 

Movie Name: Madagascar

SAP Build Challenge 1.png

 

Read only

GRABLERE
Product and Topic Expert
Product and Topic Expert
7,097

Great Challenge!:)

GRABLERE_0-1682542442176.png

 

Read only

0 Kudos
7,086

Thanks for participating 😺




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

WannL_Tan
Explorer
7,095

Great exercise!

WannL_Tan_0-1682568857470.png

 

Read only

0 Kudos
7,092

Thanks for joining 😺 The numbers are slightly off. I assume you rounded down instead of up.




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

7,079

Thanks Dan.  I used function DIV rather than divide with function CEIL.

Read only

VinayKumawat
Product and Topic Expert
Product and Topic Expert
7,032

I am little late, but it is never too late to learn.

Thanks for the challenge.

Movie is Madagascarchallenge1.png

 

Read only

0 Kudos
7,017

Never too late, and still more than a week left to do at least 1 more 😺




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

TimothySanty
Participant
7,030

Hello everyone! I'm a bit late to the party but I'm always game for a challenge! To be honest this one was more difficult than I anticipated. Looking forward to the next! The movie is Madagascar BTW.

TimothySanty_0-1682676636752.png

 

Read only

0 Kudos
7,018

Nice work 😺 Please do the others, too




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

johna69
Product and Topic Expert
Product and Topic Expert
7,002

Movie I already saw someone elses answer... Madagascar ..... 

 

Screenshot 2023-04-30 at 11.33.09 PM.png

Read only

0 Kudos
6,966

Thanks for participating 😺




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

P000636
Active Contributor