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

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

Thanks for participating 😺consider now doing the other challenges




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

Thanks!!!SAP_Build_challenge_1_gabriel_ayuso.png

0 Kudos

Please consider doing the other challenges 😺




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

Dasig
Participant

Hello Dan,

Just found about this challenge, thanks!

it took me a while to understand the logic of formulas... 🙂

 

Dasig_0-1682960332121.png

 

 

0 Kudos

Glad you found out about at least now ... still a week to do some of the others 😺




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

JVLebbink
Explorer
0 Kudos

JVLebbink_2-1683019927168.png

My interpretation of the challenge 😉

jj
Active Contributor

Hi Dan,

This was great learning. Recently attended the build Hackathon.

Please find the result

jj_0-1683040668867.png

Movie I really don't know. 🙂

 

Dan_Wroblewski
Developer Advocate
Developer Advocate
0 Kudos

Nice! Keep on learning and building! 😺




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

brodierose
Explorer

Here is my Week 1 Challenge submission.

Movie: Madagascar

IMG_9347.jpg

Regards, Brodie

Akash-B-R
Product and Topic Expert
Product and Topic Expert

Hey Dan,

My Week 1 Challenge submission.

Movie: Madagascar.

SAP Build Challenge 1.png

Cheers,

Akash.

joeremo
Participant

Hi, this was a good challenge.

Here is my screenshot:

Screenshot_20230506_100042_SAP Build Apps.jpg

I found it interesting that the initial data for the StartValue (Page Variable) was found in the "Assigned value" in the Logic for the Page, instead of in the VARIABLES section where StartValue was created.

I also found it interesting to use the History>Replace to import the file instead of the Import option in Lobby.

It is nice to know the different options.

Movie is Madagascar!

0 Kudos

yes, the export feature is really helpful. Sorry about putting the logic in the wrong place.




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

aonunes
Explorer

Awesome challenge.

aonunes_2-1683419216170.png

The movie is Madagascar 😁

Thanks ... glad you liked 😺




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

ALEJONO
Participant
0 Kudos

Hi @Dan_Wroblewski.
The movie is Madagascar.
Here is the screenshot of the app:

ALEJONO_0-1683456162237.png

Kind regards,

Ale.

sabaameer13
Newcomer
0 Kudos

Hello, A little bit late to submit but here is my submission. Thanks for making me learn new things

sabaameer13_0-1714117023345.png

 

0 Kudos

Still plenty of time. Nice work 😸

Try the current challenge: https://community.sap.com/t5/sap-builders-discussions/april-citizen-developer-challenge-sap-build-ap...




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