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,483

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

RichDBlumberg
Participant
18,136

Thanks! Look forward to giving this interesting challenge a try! 

14,819

Where can I learn! Are there any trainings? 

14,750

Did you try out the challenge first?

After that:

https://learning.sap.com/learning-journey/compose-and-automate-with-sap-build-the-no-code-way

https://learning.sap.com/learning-journey/utilize-sap-build-for-low-code-no-code-applications-and-au...

And internally at SAP there are additional resources, if you contact me offline




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

abdullahgunes
Participant
18,126

Hi all,

First answer from me 🙂

Movie: Madagascar

image.png

18,116

Thanks 😊 But can you add screenshot without the blur




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

PatrikMajer
Explorer
18,137

Hi Dan, 

thank you for a great challenge. 

PatrikMajer_0-1680270883609.png

 

17,796

Movie is Madagascar - of course

17,789

😺

But did you build the formula and solve the non-bonus challenge?




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

17,782

Yes - we worked together with Patrik (he is my Padawan) on the solution above 🙂

Btw great Idea these dev challenges - really funny way how to learn - not just - problem solving, algorithmic thinking and as a bonus - deep dive to the tool (Appgyver) itself and documentation as well.

17,768

The force is strong in you. Thanks for kind words and for participating.




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

17,733

One requirement was to round up to no decimal points ... can you do that?




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

17,704

He does that on friday, but posted picture only on teams (and without name). Now he has day off - so just like that:

vbalko_0-1680517401723.png

And screenshot of our team as a proof 🙂

vbalko_1-1680517438397.png

 

17,679

Hi Dan, 

I have overlooked this requirement on Friday. Formula updated on Friday evening as mentioned by my colleague Vlado 🙂

Have a great day.

PatrikMajer_0-1680520693803.png

 

 

induthiru
Participant
18,118

Hello Dan,

Thanks for this challenge, tricky and interesting 🙂. Please see the screenshot below:

induthiru_0-1680274706095.png

Regards,
Indu

encarrero
Participant
18,097

038B4D7D-1209-4CBA-9029-44734C32E5B4.jpeg

Farid
Active Participant
18,090

ChatRenfrogne.jpg

 

aoyang
Contributor
18,049

Completed the challenge but don't know what movie they are from 🙃

SAP Build Challenge.jpg

Ajit_K_Panda
Product and Topic Expert
Product and Topic Expert
17,884

Hi, 

ajitkumarpanda_1-1680437552920.png

Looking forwards to the next challenge!!

Krishnakumar
Product and Topic Expert
Product and Topic Expert
17,776

Hi, Here is my screenshot.  

Krishnakumar_2-1680514460344.png

 

 

17,755

Nice ... but you're supposed to enter your name in the input box 😉




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

Krishnakumar
Product and Topic Expert
Product and Topic Expert
17,739

Movie is Madagascar

Krishnakumar_0-1680515743943.png

Added my name now

manuelbordallo
Explorer
17,706

Hello,

Done!

Film: Madagascar 😉

SAP_Build_Apps-3.jpg

Best regards,

Manuel

17,688

That's one grumpy cat!! What happened to your name?




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

17,634

I didn't read all the "requirements"... 😅

SAP_Build_Apps-4.jpg

17,624

RTFM 🙂




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

PAstolfi86
Explorer
17,553

Hi, below my screenshot.

PAstolfi86_0-1680536117426.jpeg

Regards.

Piervincenzo Astolfi

anjalymgeorge
Discoverer
17,496

Hi Dan,

Thanks for the challenge.

anjalymgeorge_0-1680552331120.png

 

MioYasutake
Active Contributor
17,499

My week 1 submission. The formula was a bit challenging for the first week.

miyasuta_0-1680554991927.png

 

17,382

Glad you stuck with it and succeeded 🕺




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

SandipAgarwalla
Active Contributor
17,355

Finally managed the formula using the hints you have given. Thanks for this interesting learning challenge. 

Week1 - Challenge.jpg

0 Kudos
17,350

Glad it worked out (and you made my grumpy cat happy) ... do you know the movie the data aggregation results hint at? 




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

17,338

mad.jpg

one of my favorite movies. 

0 Kudos
17,319

Yes, but which is your favorite - 1, 2 or 3?




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

0 Kudos
17,287

I would say the 2nd one. Which one is your favorite

17,202

I agree

Zuba: Alakay, turn around!

Alex: No, Pop, it's hop, shuffle, ball change, hip swish, THEN turn around.




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

Ian_Thain
Developer Advocate
Developer Advocate

0 Kudos
17,223

Nice ... but what about the movie?




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

enzoleon
Participant
17,257

Hi Dan, nice challenge!

The movie is Madagascar 🤣

enzoleon_0-1680612414968.png

 

Bharathi_S
Explorer
17,247

Hello Dan!,

Thank you for this challenge!

Movie Name: Madagascar

SmartSelect_20230407_145741_Chrome.jpg