This post is part of the SAP Build Community Challenge (April 2023)
We're going back to SAP Build Apps for this week's challenge.
Probably the most important thing you will do with one of your SAP Build app is to access SAP data, like in S/4HANA or SuccessFactors backends. And you will generally do this using an OData service. So we want to challenge you to use some of the OData features in the tool – for paging, filtering and sorting the data from OData calls.
In the challenge, you will start with an app we will give you, which fetches data from Northwind, and you will have to use the OData settings to bring back a specific subset of the data.
As a bonus, you will also learn about SAP Build Apps eventing, since the project we give you has eventing for retrieving the data.
Since we wanted the fetching of data to occur for a variety of events, we created our own event called GetData on the page’s logic canvas, and tied the fetching to that event. Then, the event could be called from any other logic canvas.
To learn more, see:
Out of the box if you run the app it will look like this:
The Previous and Next buttons will not work. You will have to implement them.
We have already given you a page variable page (Number) to keep track of the current page, and a data variable Customer1 to hold the data fetched from Northwind.
It should look something like this (with your name, of course), but the records will be different. To accomplish the challenge, the correct records must be shown.
And feel free to Kudo this post and all the challenges.
Add in your post the name of the animated movie in which the song "Escape" (often known as the Pina Colada song) is played, and describe in 1 sentence the scene in which it appears.
Add the movie and scene description to your entry, and then go enjoy a Pina Colada (or your favorite drink).
Here is my submission for week 4 challenge.
I am able to disable the Previous button. But to disable the Next button, I need to find another way as 'Get record collection' is not returning the count of the records from the OData call.
The Pina Colada song is from Guardians of the Galaxy where Star-lord plays it from his cassette player multiple times as I remember.
Hi @dan_wroblewski ,
I've added some aditional features to this App and I've obtained a weird behaviour you can see in the last seconds of the video. It is related to display one record in another screen. The first attemp didn´t display any value but in the second attemp everything was ok. i got this system behaviour many times.
Could be related to be querying to the OData service frequently?
Is there any way to extrtact a data subset from the current registers which are being displaying (i.e. Country) and fill a Dropdown list with the aim to filter for the value I could select?
I will appreciate your comments.
VIDEO URL: https://youtu.be/KYF9soIhV-g
I'd have to see the entire logic flow. I see that you briefly get the data and it then disappears ... there must be some setting of the page parameter and a another retrieval of data that resets the data variable. Anyway, if you want to share the project I could check.
Thanks for participating 😺
I've done some changes and the display data is shown correctl.
I think the issue was because I had a same logic implemented twice. The first one is a logic within Data Variable I've created in the 2nd page. And last one, was a logic associted to the TAP Event (on each list row) in the first page. I've deleted the Tap Event logic within 1rst page.
The only reason why the system is displaying this message content is because of the Page mounted event is triggered first and after that is triggered the logic within Data variable you can see next
LOGIC WITHIN DATA VARIBLES (2nd page)
On the 2nd page is shown the Country field. I've saved the flag countries are displayed on the first page when ContactTitle = 'Owner'in local storage.
The aim is to display the flag on the 2nd page when is tapped one register. For this, I've created a formula "ag-asset://" + data.CustomerDetail.Country + ".png" to take the Country name register in the field CustomerDetail.Country adding the .png extension but nothing is displayed.
i've done a test using only one country flag, Venezuela flag, and of course it works but I don't understand why the name of file Venezuela.png is changed to this value: ag-asset://1d49d5bc-3ddf-4858-8d87-386250f868cc
Maybe I have to use a conversion function to changethe name of the file Venezuela.png to the code ID ag-asset://1d49d5bc-3ddf-4858-8d87-386250f868cc ?
So first of all it's natural at page mounted for the data to be empty as the data variable is gotten only after page mount. So any logic run should only be after the data variable is checked, either via looping and checking if the data variable is not empty anymore, or on the data canvas.
As for the image display, the ag-asset:// type of url is only for images uploaded to Build Apps. Ideally you should have the url of the image displayed in the data itself instead of needing to generate it, and I don't know how you would be able to come up with the url on the fly if you don't have it saved.