cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
chris73
Level: Powered On

How to convert/filter composite Entities from JSON/LUIS?

Hi guys,

 

I want to do the following and I was wondering if you could help me with step 2 + 3:

 

0. Read E-mails and check if a customer wants to order smth (Status: Working)

 

1. Luis makes predictions and I recieve that prediction and parse the JSON information (Status: Working)

 

2. Read/Extract the composite/Entities (parent/child) in an array (or object?) so I can later select itemnumber,unit and quantity to create a Sales Order line. I guess you only needed the "Composite Entitites" part but I copied the whole code just in case: "entities":

 

"entities": [
    {
      "entity": "pcs",
      "type": "unit",
      "startIndex": 10,
      "endIndex": 12,
      "resolution": {
        "values": [
          "PCS"
        ]
      },
      "role": ""
    },
    {
      "entity": "kg",
      "type": " unit ",
      "startIndex": 28,
      "endIndex": 29,
      "resolution": {
        "values": [
          "KG"
        ]
      }
    },
    {
      "entity": "a00001",
      "type": "itemnumber",
      "startIndex": 0,
      "endIndex": 5,
      "role": ""
    },
    {
      "entity": "a00002",
      "type": " itemnumber",
      "startIndex": 18,
      "endIndex": 23
    },
    {
      "entity": "10",
      "type": "qty",
      "startIndex": 7,
      "endIndex": 8,
      "role": ""
    },
    {
      "entity": "20",
      "type": "qty",
      "startIndex": 25,
      "endIndex": 26
    },
    {
      "entity": "a00001",
      "type": "item",
      "startIndex": 0,
      "endIndex": 5,
      "score": 0.7192809
    },
    {
      "entity": "10",
      "type": "item",
      "startIndex": 7,
      "endIndex": 8,
      "score": 0.7887993
    },
    {
      "entity": "pcs",
      "type": "item",
      "startIndex": 10,
      "endIndex": 12,
      "score": 0.5503607
    },
    {
      "entity": "a00002",
      "type": "item",
      "startIndex": 18,
      "endIndex": 23,
      "score": 0.6375311
    },
    {
      "entity": "20",
      "type": "item",
      "startIndex": 25,
      "endIndex": 26,
      "score": 0.93265295
    },
    {
      "entity": "kg",
      "type": "item",
      "startIndex": 28,
      "endIndex": 29,
      "score": 0.968041658
    }
  ],
  "compositeEntities": [
    {
      "parentType": "item",
      "value": "a00001",
      "children": [
        {
          "type": "itemnumber",
          "value": "a00001"
        }
      ]
    },
    {
      "parentType": "item",
      "value": "10",
      "children": [
        {
          "type": "qty",
          "value": "10"
        }
      ]
    },
    {
      "parentType": "item",
      "value": "pcs",
      "children": [
        {
          "type": "unit",
          "value": "pcs"
        }
      ]
    },
    {
      "parentType": "item",
      "value": "a00002",
      "children": [
        {
          "type": "itemnumber",
          "value": "a00002"
        }
      ]
    },
    {
      "parentType": "item",
      "value": "20",
      "children": [
        {
          "type": "qty",
          "value": "20"
        }
      ]
    },
    {
      "parentType": "item",
      "value": "kg",
      "children": [
        {
          "type": "unit",
          "value": "kg"
        }
      ]
    }
  ],

 

3. Do a "Apply to each" and extract each object with its content (item - itemnumber, unit, quantity) into single variables so I can use them as an Input for Step 4. (Status: Not working)

 

4. Create Sales Order Lines (in the same "Apply to each" as Step 3) in Finance and Operations (Status: not there yet).

 

I know there are simple manuals out there to create excatly one sales order line but they are not flexible enough and they do not use "composite Entitites" which i think are required.

2 REPLIES 2
Super User
Super User

Re: How to convert/filter composite Entities from JSON/LUIS?

Have you tried using the Parse JSON action. You can configure this action using your sample json that you posted earlier.

chris73
Level: Powered On

Re: How to convert/filter composite Entities from JSON/LUIS?

Hi Pieter,

 

thank you for your reply. Yeah I tried it but I came to the conclusion that I need a unique ID to identify each child and its corresponding parent. Currently Microsoft Luis does not give me the ability to create a unique ID for each parent/child. That way I could only "guess" which unit and quantity belongs to my item. I will wait and hope that this feature will be available in the future.

 

Until then I restricted my flow to exactly one item, unit, quantity. 

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 4 members 3,187 guests
Recent signins:
Please welcome our newest community members: