I did the web traditional course, and there's this part where an API connection is made so the movies can have their posters. In the detail pages its working just fine.
I tried to make a home page, with a list records where a get all the work from the db is listed in a shape of gallery, and the cards are getting the right information from the current work.
I did the same config for the poster, where I get the current name from the work in that card and in response I get the poster path. What is going wrong is the first poster is repeating in the rest os the cards. They show the right information from the work but not the right poster.
I dont know what else to try so if any of you could help me I'd appreciate it!
Down bellow are some prints from the website and service studio:
Hi Julia,
I think this solves your problem:
1. Create a structure "KdramaInfo" to store some movie information like Title, Year, Genre, TotalEpisodes, AvgRating and Image (if you need more information you can add more attributes to the structure as well).
2. Create a server action "GetMoviesList" to fetch all movies that you have on your DB and match them with the information on the API to retrieve the image for example.
3. Use the "GetMoviesList" server action in your preparation.
4. Use the output of the "GetMoviesList" action in your UI (Table, Image, and Expressions)
See the OML attached.
I have some dependencies missing so I couldn't test it, but you can see the code and apply it to your original module.
Let me know if worked.
Kind regards,
FC
To solve the first issue add the "KdramaId" attribute to the "KdramaInfo" structure and assign the value on the server action "GetMoviesList". On the Home screen table link the Title to the KdramaDetail screen and pass the value of the current KdramaId as the input parameter to the KdramaDetail screen.
To solve your second issue, on the Home screen create a local variable "Search" of data type text, assign the local variable to the input widget and create a handler for the "OnChange". In the "OnChange" action refresh the data.
Add an input parameter "Search" to the "GetMoviesList" action and apply the filter on the aggregate: Search = "" or Kdrama.Title like "%" + Search + "%"
Let me know if it works.
I hope you're doing well.
First of all welcome to the OutSystems world :)
Regarding your issue, on your list for each record, you're showing different movie names, years, number of episodes, etc but the image is the same on all records.
Did you debug the API "GetKdramaInfo" server action to see what you're receiving from the API? Maybe the API is sending the same image for all movies.
Can you confirm what value you give to the Image widget on the List? Maybe you've given the same value to each record.
Btw in the method "GetKdramaInfo", you're sending the current record of the list, so it's normal that the image is the same, because this method only retrieves the information for one given movie. You need to use another method to retrieve the list of all movies.
If you can share the OML file it'll be easier to see what is happening in your situation.
Let me know your thoughts.
Hello Fábio! Thank you for replying!
Yes, that's the issue with my home screen. The debug showed me the infos from the work that is indeed repeating in all cards:
And this is the external URL in the image value widget: Site.TheMovieDB_BaseURL + GetKdramaInfo.Response.Results.Current.Poster_path
I tried to attach the oml file here but its bigger than the limit, so I uploaded on GD.
https://drive.google.com/drive/folders/1jOzbbzvyjlhZlRBClUjGyG8Hs5x74f3P?usp=sharing
Hello Julia,
Can you upload the JjangList_Core module in google drive please as well, please?
With missing dependencies, I can't debug.
Btw if you can isolate only the HomeScreen and the API action in a module, export the module and share here is better. Because I can't publish if you share your module on google drive.
Thank you,
Here's the core module!
And here its a module just with homescreen and the REST API connection
Hey! It worked really well for the home page! Thank you!!
But some other features stopped. For example:
1 - The link at the title was set to go to KdramaDetail page, but this page asks for a ID (type identifier). Since there's not an ID on the GetKdramasList method, It's not working.
2 - There was a search option on this home page with automatic refresh, but its also not working anymore because of the data sourse.
Fábio, it worked really well for the KdramaId, where its sending to their detail page just fine! Thank you so much, really helped me and this college project of mine!
As for the search input, when I start writing the name of some work, the layout breaks and doesn't show only the one I'm searching for. I'm thinking of removing this input anyway if it doesn't work.
Hii Julia,
I think the issue is that your action "GetKDramaInfo" returns only a single value as I can see the input parameters it takes
as it is taking only a single value which will fetch only a single record according to the current value.
to find the solution to your problem please share the oml if possible.
Best Regards,
Adeeb Alam
Hey Adeeb, Thanks for the reply!
Here's the link for the oml file (couldn't attach here because of the size).