
In today's digital age, customer reviews hold significant power in shaping buying decisions. For businesses striving to understand and improve customer experiences, harnessing the potential of AI becomes a game-changer. Sentiment Analysis is one area which can help businesses understand how customers perceive their products or services.
Based on this analysis, businesses can prioritize improvements, address issues, and make strategic decisions to enhance their offerings. Positive sentiments can be leveraged for marketing purposes, while negative sentiments can indicate areas needing improvement or damage control. At the same time, it helps users make an informed decision on which products they should buy.
There are many tools available today, that can help you build on this use case. However, the purpose of this blog is to showcase how this can be accomplished using No-Code tools and by leveraging SAP AI Core for Generative AI capabilities.
This ensures that citizen developers with no coding expertise or who can sometimes feel overwhelmed by the complexities of programming, are able to build applications within few hours.Also professional developers can quickly prototype with drag and drop ease and minimal configurations.
Today, I will take you through the process of creating a full stack application with SAP Build Apps and Generative AI that helps perform sentiment analysis on product reviews.
Let's quickly dive into the details.
At its core, this app organizes products and their associated reviews, offering a comprehensive overview. It allows users to enter a product review and then categorizes it into positive, negative, or neutral review using Open AI’s ChatGPT to perform sentiment analysis.
The application consists of the following main parts:
Prerequisites
![]() | ![]() | ![]() |
5. Click Set formula and enter the following formula:
GROUP(outputs["List records Reviews / Records listed"].records,item.productId,{productID:key,positive:COUNT(SELECT(items, item.sentiment == 3)), negative:COUNT(SELECT(items, item.sentiment == 1)), neutral: COUNT(SELECT(items, item.sentiment == 2))})
6. Deploy the backend.
Please refer to this blog for more details on how to create Visual Cloud functions.
![]() | ![]() | ![]() |
Field | Binding |
Repeat with | The data variable Products1 |
Title label | Data item in repeat: current.ProductName |
positiveReviewCount | DEFAULT(FIND_BY_KEY(appVars.reviewCounts,"ProductID", STRING(repeated.current.ProductID)).positive,0) |
negativeReviewcount | DEFAULT(FIND_BY_KEY(appVars.reviewCounts,"ProductID", STRING(repeated.current.ProductID)).negative,0) |
neutralReviewcount | DEFAULT(FIND_BY_KEY(appVars.reviewCounts,"ProductID", STRING(repeated.current.ProductID)).neutral,0) |
Image Source | You can choose any image of your choice |
Field | Type | Purpose |
productID | Text | The product to be displayed on the product page, received when the user clicks on a certain product in the list of products |
Field | Binding |
Title | Data Variable Product1.ProductName |
Text1 | Formula "Quantity Per Unit - "+data.Product1.QuantityPerUnit |
Text2 | Formula "Units in Stock - "+data.Product1.UnitsInStock |
Text3 | Formula "Price - "+data.Product1.UnitPrice |
Property | Binding |
Primary label | Data Item in Repeat |
Secondary Label | Formula - " - "+repeated.current.reviewedBy |
Arrow Visible | False |
Text3 | Formula - "Price - "+data.Product1.UnitPrice |
newReviewSentiment | text | Store the sentiment of the review given. |
newReview | Text | Contains the text the user enters as a new review |
AIPayload | Object | Request Payload for the AI Core API |
Component Tap -> Set Page Variable -> Create Record -> Set Page Variable -> Create Record-> Navigate Back
Set Page Variable | Variable name – AIPayload Assigned Value – Object with Properties max_tokens - 256 top_p - 1 temperature - 0 model - gpt-35-turbo-16k n - 1 stream - False messages - List of values [ { role: "system", content: "You are a helpful assistant which does sentiment analysis." }, { role: "assistant", content: "Return 3 for positive, 2 for neutral and 1 for negative." },{ role: "user", content: pageVariable - newReview } ] |
Create Record | Resource – AICoreLLM Record – Page variable - AIPayload |
Set Page Variable | Variable Name – newReviewSentiment Assigned Value – Formula - outputs["Save the AICore Response"].response.choices[0].message.content |
Create Record | Resource – Reviews Reviews – Object with properties Review – Page Variable – newReview ProductID – Page Parameter – ProductID sentiment – Formula - NUMBER(pageVars.newReviewSentiment) ReviewedBy – your name DateCreated – Formula - NOW() |
I would like to thank gunteralbrecht , jayadnure for helping and guiding me in my learning journey. Special thanks to daniel.wroblewski for below blog posts which helped me understand SAP BUILD better –
With that, I come to the end of my very first blog.
Do let me know your thoughts in the comments section.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |