cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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
Highlighted

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

Highlighted

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (12,993)