Part 3: PowerApps Rock! Forget the “slick code” and deliver on robust and maintainable business solutions


Rich Carlsen, Cloud Solution Architect

In my first blog post, we discussed how IT organizations need quality applications with reduced complexity, which can be delivered quickly with a low cost of ownership and high level of maintainability. Configurable application frameworks like PowerApps have a very professional presentation layer that will run on most platforms. Plus, PowerApps can be fully integrated with most cloud service architectures, bringing loads of application functionality to your users.

Focus

Today’s focus will be building your own application based on your favorite hobby using the architectural example provided in my last blog.

Building the application

Step 1 – Provisioning Azure Cognitive Services

Step 2 – Create PowerApps connectors for accessing Azure Cognitive Services

  • Bing Search: From the Azure Portal, copy Bing access keys from the Bing Search API that you just created

  • From PowerApps Studio, select File > Data > Connections > +Add. From there, select “Bing Search,” and enter the API key retrieved from the Azure portal. Then click “Create”

  • Text Analytics: To configure Azure Cognitive Services Text Analytics, you’ll need to supply a site URL endpoint, in addition to the API access API key in PowerApps. This information can be found on the Text Analytics overview screen in the Azure portal

  • Using PowerApps Studio, select File > Data > Connections. Then +Add Text Analytics and copy the endpoint URL—along with access keys—from the Azure Portal into PowerApps when creating a Text Analytics connector

Step 3 – Creating the PowerApps application

  • You can create an application through the preconfigured App Templates in PowerApps Studio by choosing the “Blank App” using the Phone Layout

  • An empty screen will appear. Rename your screen to scrHobbySample and select “Connect to data
  • With your new blank application open in PowerApps Studio, navigate to View > Data Sources > +Add Data Source, and select the Text Analytics and Bing Search data connections that you created earlier

Step 4 – Make the application your own, based on your favorite hobby

  • Add controls: Navigate > Insert and add two new controls, plus one new label used for your heading. Rename the label “lblHeaderText_HobbySample”

  • Add one new Gallery control used for your content. Select “Blank Vertical”

  • Bing News Search

  • Select the new Gallery control you created, and enter the following text in the “Items” property
  • Replace the “Cute Puppies” query string with your favorite hobby or interest

// We are performing a Bing news search for "Cute Puppies" and returning 50 items

// sorted by date published for the latest news first

//

Sort(BingSearch.GetNews("Cute Puppies", {count: 50}), datePublished, Descending)

  • Display your data:
    • Select your Gallery control
    • Under Fields on the right, select “Edit”
    • For Layout, select “Title and subtitle”
    • Rename your new label controls to something meaningful
    • On the Data pane, assign the “name” data field for your title, and the “description” data field for your subtitle

  • Once you resize your Gallery items and label controls, and you should get this. The search query may need some refinement

  • Add Sentiment Analysis:
    • Insert a new label into the Gallery, and rename the label to “lblSentiment_Hobby Sample”
    • Enter the following code with comments in the text box

//Passing description data field from big news to Azure Cognitive Services Text Analytics for Sentiment analysis

//then converting the return value to a percentage

//

"Cute Puppy News Sentiment: " & Value(Round(TextAnalytics.DetectSentiment({text:description}).score, 2)*100) & "%"

And there it is! You are now off and started with PowerApps and Azure Cognitive Services. You can find more information on creating PowerApps here. Happy coding! For more information on PowerApps, visit Microsoft PowerApps Guided Learning.

Applications and Infrastructure Technical Community

Comments (0)

Skip to main content