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

thecodester
Developer Advocate
Developer Advocate

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
174 REPLIES 174

thecodester
Developer Advocate
Developer Advocate
0 Kudos

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

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

Sorry!!

hismail
Discoverer

Hi Dan,

Thanks for the interesting challenge.

Movie: Madagascar

 

Challenge 1 - Hesham Ismail.jpg

 

dinah
Product and Topic Expert
Product and Topic Expert

My Output:

dinah_0-1681996290880.png

 

thecodester
Developer Advocate
Developer Advocate
0 Kudos

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

Pamela
Product and Topic Expert
Product and Topic Expert

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

thecodester
Developer Advocate
Developer Advocate
0 Kudos

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

sainithesh21
Active Participant

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

 

0 Kudos

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

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 😀

rajkumar
Explorer

0 Kudos

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

HelenaFortun
Explorer

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

0 Kudos

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

vinay050
Participant

Hello @thecodester ,

Really enjoyed working on this challenge. 

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

vinay050_0-1682213676572.png

Regards

Vinay

rsraj
Explorer

Hello Dan,

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

Challenge1.PNG

thecodester
Developer Advocate
Developer Advocate
0 Kudos

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

shridharshetty
Explorer

Thanks for the Build Challenge.

Movie name: Madagascar.

Week 1.png

0 Kudos

Great job ... thanks for participating 😺




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

mrpz
Explorer

Hello,

Starting at full speed the challenge this week! 🙂 

The Key is to work with the appgyver doc webpage.

mrpz_0-1682363729421.png

 

thecodester
Developer Advocate
Developer Advocate
0 Kudos

Nothing better than good documentation 😺




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

jakku
Explorer

Great Challenge, Below is my screenshot.

 

Screenshot 2023-04-25 155310.png

thecodester
Developer Advocate
Developer Advocate
0 Kudos

Thanks for participating ... please enjoy the others 😺




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

Alejandro1
Product and Topic Expert
Product and Topic Expert

Hello @thecodester,

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 🙂

 

0 Kudos

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

CarlGP
Newcomer

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

 

thecodester
Developer Advocate
Developer Advocate
0 Kudos

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




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

staseeb
Active Participant

Hello @thecodester ,

Thank you for this challenge! 

Movie Name: Madagascar

SAP Build Challenge 1.png

 

GRABLERE
Product and Topic Expert
Product and Topic Expert

Great Challenge!:)

GRABLERE_0-1682542442176.png

 

0 Kudos

Thanks for participating 😺




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

WannL_Tan
Explorer

Great exercise!

WannL_Tan_0-1682568857470.png

 

0 Kudos

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

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

VinayKumawat
Product and Topic Expert
Product and Topic Expert

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

Thanks for the challenge.

Movie is Madagascarchallenge1.png

 

0 Kudos

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

TimothySanty
Participant

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

 

0 Kudos

Nice work 😺 Please do the others, too




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

johna69
Product and Topic Expert
Product and Topic Expert

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

 

Screenshot 2023-04-30 at 11.33.09 PM.png

thecodester
Developer Advocate
Developer Advocate
0 Kudos

Thanks for participating 😺




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

P000636
Active Contributor