Showing posts with label PowerFx. Show all posts
Showing posts with label PowerFx. Show all posts

Tuesday 6 December 2022

Using the OpenAI PowerFx language helper leading into building a Tax chatbot using Power Apps (No model training)

I had some time today, and I've been hearing a lot about OpenAI/GPT-3, so I thought I'd have a look around and wow it's good.  There are so many uses and it's just easy to use.

For instance, Power Apps uses PowerFx which is a simple language that Microsoft had added the "Ideas" are to that helps you build PowerFx code.  Honestly I found it extremely irritating when it was released recently but after reading more on Open AI I to take a closer look and it definitely is a great idea.



Thoughts:  I don't memories code so I feel this is a great tool for citizen and professional developers.  I think it will get a lot of attention and improve over time and become a key part of PowerFX and app development.

More Info:

https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/power-apps-ideas

OpenAI - Took less than an hour to setup the demo

The Power Platform has a Premium Connector to use the OpenAI API's.  Robin Rosengrun has a demo and built and published a connector. 

I spent some time playing around with the OpenAI GPT-3 API using the "davinci-002" engine in a Power App connector.    

First search data result is correct
This is completely wrong, although HMRC have amended the go live date many times.  I was hoping for "6 April 2024"

The third question result is good - but could be better.

Sunday 20 November 2022

Power Apps issue with OptionSets Syntax irregularity

Problems: OptionSets in Power Apps (Canvas apps can be a little nasty to work with, today I took a couple of hours  trying to use an OptionSet to filter results.  This should have taken 5 minutes but there is a weird behavior when using switch or if statements to dynamically filter using options sets.

Hypothesis:  using if/switch logic when using an OptionSet in Dataverse to filter results in the code being change/interpreted incorrectly at run time. 

Resolution:  Use a variable to hold the dynamic OptionSet choice as shown above.  I hope this post can help anyone having issues relating to Option sets for filtering and updating.

In the example below I show how to Insert a new Row using a Patch where the row contains an OptionSet.  It's ugly but, it works...

On the Save...
Set(orgType, Blank());
If(
    <ddlOrgType.Value> = "Personal", Set(orgType, 'Org Type'.'Sole Trader'),
    <ddlOrgType.Value> = "Incorporated", Set(orgType, 'Org Type'.'Limited Company'),
    <ddlOrgType.Value> = "Partnership", Set(orgType, 'Org Type'.'Partnership')
    );
Insert the new row for Subject

Sunday 11 September 2022

Power Platform Added Features

 August/September 2022 has been a busy month for the Power Platform

Here are two experimental features I think are massive: Named formulas & ParseJSON

New upcoming feature

ParseJSON

Coauthoring improvement will also be important for enterprise development.

October 2022: 
Power Pages are now in GA (Genral Availability)
Nearly 700 Connectors
A few new features/functionality I like: 



Tuesday 2 August 2022

Dealing with JSON strings in Power Apps

Overview: I get a JSON string representing an object into Power Apps.  I want to extract the values so i can use them in PowerApps.  Since this post, the ParseJson function was release in Power Apps, use that instead.

Tip: The is a great website for looking at JSON.  Otherwise I tend to use VS code.

Possible Solutions:  

  1. In Power Automate, split up the JSON (using ParseJSON) and return multiple Power Apps variables - only useful is you need a small specific subset of the JSON data.
  2. In Power Apps, use string manipulations to extract data as shown here:

Thoughts: I feel this is a big challenge for NoCode/LowCode solutions like Power Platform, it can be overcome with a little jiggery-pokery but I feel the PowerFx language should have an ability to cast JSON into an object and in turn allow object arrays in collections.  A lot of people have been asking for this on UserVoice.

Update: Sept 2022

The ParseJSON function is now in Power Canvas Apps, a huge improvement.  There is still an issue, the ParseJSON in not strongly typed, so it's still hard to deal with complex objects containing arrays in Canvas Apps.  Ideally I'd like to be able to add a schema to run against the untyped object to have a strongly type object to work with.