This is sort of a follow up question to this. I want to use 2 parameters in my assistant command. When I used only 1 parameter for a command, code worked flawlessly. However, when I added a second parameter to query pattern, the pattern was never detected. I have pasted my actions json file below. What have I missed?
{
"manifest": {
"displayName": "Start Test",
"invocationName": "Start Test",
"category": "PRODUCTIVITY"
},
"actions": [
{
"name": "com.example.actions.StartTest",
"availability": {
"deviceClasses": [
{
"assistantSdkDevice": {}
}
]
},
"intent": {
"name": "com.example.intents.StartTest",
"parameters": [
{
"name": "testname",
"type" : "TestSchema"
},
{
"name": "machinename",
"type" : "MachineSchema"
}
],
"trigger": {
"queryPatterns": [
"prepare ($TestSchema:testname) on ($MachineSchema:machinename)",
"start ($TestSchema:testname) on ($MachineSchema:machinename)",
"launch ($TestSchema:testname) on ($MachineSchema:machinename)"
]
}
},
"fulfillment": {
"staticFulfillment": {
"templatedResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "Preparing to start test $testname on $machinename"
}
},
{
"deviceExecution": {
"command": "com.example.commands.StartTest",
"params": {
"testname": "$testname",
"machinename": "$machinename"
}
}
}
]
}
}
}
}
],
"types": [
{
"name": "$TestSchema",
"entities": [
{
"key": "BURN IN",
"synonyms": [
"burnin",
"burn in",
"burning",
"button"
]
},
{
"key": "WINTHRAX",
"synonyms": [
"when thanks",
"print tracks",
"fintrax",
"win tracks",
"winter sucks"
]
},
{
"key": "REBOOTER",
"synonyms": [
"reporter",
"repeat here",
"reboot"
]
},
{
"key": "SLEEPER",
"synonyms": [
"sleeper",
"sleep here",
"slipper"
]
},
{
"key": "IOMONKEY",
"synonyms": [
"are you monkey",
"I O monkey",
"I am monkey"
]
},
{
"key": "DISKERCISE",
"synonyms": [
"discus size",
"discuss I",
"Tisca size",
"Kiska size",
"discuss Eyes"
]
},
{
"key": "MFCJUNI",
"synonyms": [
"M F C Juni",
"MFC tunie",
"MFC tune",
"MFC Tu Ne"
]
},
{
"key": "SD STRESS",
"synonyms": [
"S D Stress",
"H D Stress",
"SD stress",
"HD stress",
"is distress",
"s distress",
"sdstress",
"SPSS",
"has De stress",
"FB status",
"HD stores",
"St stress"
]
},
{
"key": "POUNDIT",
"synonyms": [
"pound it",
"pundit",
"found it",
"foundit",
"pound rate",
"founded"
]
}
]
},
{
"name": "$MachineSchema",
"entities":[
{
"key": "HP LANE",
"synonyms": [
"HP lane",
"hp lane",
"hp line",
"h plane",
"hplane",
"hp name",
"HP rain",
"hp rain",
"HP name"
]
},
{
"key": "TPC-1001",
"synonyms": [
"tpc1001",
"tpc one thousand one",
"tpc 1001",
"tpc one thousand 1"
]
},
{
"key": "TPC-1002",
"synonyms": [
"tpc1002",
"tpc one thousand two",
"tpc 1002",
"tpc one thousand 2"
]
},
{
"key": "TPC-1003",
"synonyms": [
"tpc1003",
"tpc one thousand three",
"tpc 1003",
"tpc one thousand 3"
]
}
]
}
]
}
(Extracted answer from comments for higher visibility)
Do you need the parameters in parenthesis? It should be fine to have it without parenthesis, or adding a ? at the end will make it a wild card.
Related
Hi I have the following JSON file format (sample) and please any one let me know how to open the file in excel columns or tables. Thank you.
{ "fields": [ "id", "name", "definition" ], "items": [ { "ref": "#28:1", "id": "1", "values": [ "1", "ABC", "This is file 1." ], "relationships": [ { "toTable": "Table 1", "relationships": [ { "id": "1", "extra": {} } ] }, { "toTable": "Table 2", "relationships": [ { "id": "1", "extra": {} }, { "id": "7", "extra": {} }, { "id": "11", "extra": {} }, { "id": "24", "extra": {} } ] }, { "toTable": "Table 3", "relationships": [ { "id": "22", "extra": {} }, { "id": "31", "extra": {} } ] }, { "toTable": "Table 4", "relationships": [ { "id": "37", "extra": {} }, { "id": "38", "extra": {} }, { "id": "50", "extra": {} } ] } ] }, { "ref": "#28:2", "id": "2", "values": [ "2", "DEF", "This is file 2." ], "relationships": [ { "toTable": "Table 1", "relationships": [ { "id": "3", "extra": {} } ] }, { "toTable": "Table 2", "relationships": [ { "id": "1", "extra": {} }, { "id": "5", "extra": {} }, { "id": "24", "extra": {} } ] }, { "toTable": "Table 3", "relationships": [ { "id": "1", "extra": {} } ] }, { "toTable": "Table 4", "relationships": [ { "id": "5", "extra": {} }, { "id": "7", "extra": {} } ] } ] }, { "ref": "#28:3", "id": "3", "values": [ "3", "GHI", "This is file 3." ], "relationships": [ { "toTable": "Table 1", "relationships": [ { "id": "1", "extra": {} } ] }, { "toTable": "Table 2", "relationships": [ { "id": "2", "extra": {} }, { "id": "5", "extra": {} }, { "id": "8", "extra": {} } ] }, { "toTable": "Table 4", "relationships": [ { "id": "5", "extra": {} }, { "id": "8", "extra": {} } ] } ] } ], "relatedObjects": [ { "TableId": "Table 1", "totalItems": 151, "totalHits": 1, "fields": [ "id", "Number", "name" ], "items": [ { "ref": "#165:28", "id": "1", "values": [ "1", "ASRU" ] } ] }, { "TableId": "Table 2", "totalItems": 282, "totalHits": 5, "fields": [ "id", "fullName", "firstName" ], "items": [ { "ref": "#68:83", "id": "5", "values": [ "5", "ABC", "Acer" ] } ] } ] }
Tried excel power query to create reports using the above JSON file format.
spreadsheet view, click the “Data” tab on the ribbon at the top of Excel. In the “Data” sections, “Import and Transform” section, select the product from Get Data > From File > JSON. Open your computer's standard "Import" window. Here, open the width where your JSON file is located.
I have the following JSON to display Card_V2 for Google Chat, (note: words with "let_" are variables):
{
"cards_v2": [
{
"card": {
"header": {
"title": "Create campaign",
"subtitle": "Please complete the following information",
"imageType": "CIRCLE",
"imageUrl": "let_avatar"
},
"sections": [
{
"widgets": [
{
"textInput": {
"label": "Campaign name",
"type": "SINGLE_LINE",
"name": "nCampaign",
"value": "let_campaign"
}
},
{
"textInput": {
"label": "Campaign subject",
"type": "SINGLE_LINE",
"name": "subject",
"value": "let_subject"
}
},
{
"textInput": {
"label": "User name",
"type": "SINGLE_LINE",
"name": "userName",
"value": "let_userName"
}
},
{
"buttonList": {
"buttons": [
{
"text": "Create campaign",
"color": {
"red": 0.502,
"green": 1,
"blue": 0.733,
"alpha": 1
},
"onClick": {
"action": {
"function": "create",
"parameters": []
}
}
},
{
"text": "Cancel",
"color": {
"red": 0.502,
"green": 1,
"blue": 0.733,
"alpha": 1
},
"onClick": {
"action": {
"function": "cancel",
"parameters": []
}
}
}
]
},
"horizontalAlignment": "CENTER"
}
]
}
]
}
}
]
}
My problem is that the "textInput" screen does not appear, but last week it did. Does anyone have any idea what's going on?
PS: the Card is the return of the onMessage(event) function in Google Apps Script
I want to make a search from object JSON but when a I found the element I want to be returned with his previous parents.
[
{
"name": "level1",
"children": [
{
"name": "level2",
"children": [
{
"name": "level3a",
"children": [
{
"name": "text",
"more": "info"
},
{
"name": "text Abc",
"more": "info"
}
]
},
{
"name": "level3b",
"children": [
{
"name": "text-C",
"more": "info"
},
{
"name": "search",
"more": "info"
}
]
},
{
"name": "level3c",
"children": [
{
"name": "info-C",
"more": "info"
},
{
"name": "search",
"more": "info"
}
]
}
]
}
]
},
{
"name": "level1",
"children": [
{
"name": "level2a",
"children": [
{
"name": "level3",
"children": [
{
"name": "text A",
"more": "info"
}
]
},
]
},
{
"name": "level2b",
"children": [
{
"name": "level3",
"children": [
{
"name": "text X",
"more": "info"
}
]
},
]
}
]
}
]
For example: if want to search "text" I want result like this
[
{
"name": "level1",
"children": [
{
"name": "level2",
"children": [
{
"name": "level3a",
"children": [
{
"name": "text",
"more": "info"
},
{
"name": "text Abc",
"more": "info"
}
]
},
{
"name": "level3b",
"children": [
{
"name": "text-C",
"more": "info"
}
]
}
]
}
]
},
{
"name": "level1",
"children": [
{
"name": "level2a",
"children": [
{
"name": "level3",
"children": [
{
"name": "text A",
"more": "info"
}
]
},
]
},
{
"name": "level2b",
"children": [
{
"name": "level3",
"children": [
{
"name": "text X",
"more": "info"
}
]
},
]
}
]
}
]
Things to considerer
only "search" in level 3 children by name property
if one o more childrens matches the search, return all of them
Basically I need to filter by the last level of object with elements matches with the search and return them with them parents.
So I have been using this logic apps template to hit the Google Analytics API and the response is in this format
{
"reports": [
{
"columnHeader": {
"dimensions": [
"ga:date",
"ga:campaign",
"ga:country",
"ga:browser",
"ga:deviceCategory",
"ga:sourceMedium",
"ga:socialNetwork",
"ga:region"
],
"metricHeader": {
"metricHeaderEntries": [
{
"name": "ga:users",
"type": "INTEGER"
},
{
"name": "ga:sessions",
"type": "INTEGER"
},
{
"name": "ga:newUsers",
"type": "INTEGER"
},
{
"name": "ga:bounces",
"type": "INTEGER"
},
{
"name": "ga:pageviews",
"type": "INTEGER"
},
{
"name": "ga:sessionDuration",
"type": "TIME"
},
{
"name": "ga:hits",
"type": "INTEGER"
},
{
"name": "ga:goalCompletionsAll",
"type": "INTEGER"
},
{
"name": "ga:goalConversionRateAll",
"type": "PERCENT"
}
]
}
},
"data": {
"rows": [
{
"dimensions": [
"20200312",
"(not set)",
"India",
"Chrome",
"desktop",
"(direct) / (none)",
"(not set)",
"Tamil Nadu"
],
"metrics": [
{
"values": [
"4",
"4",
"4",
"0",
"111",
"5100.0",
"111",
"0",
"0.0"
]
}
]
},
{
"dimensions": [
"20200316",
"(not set)",
"India",
"Chrome",
"desktop",
"(direct) / (none)",
"(not set)",
"Tamil Nadu"
],
"metrics": [
{
"values": [
"1",
"1",
"0",
"0",
"6",
"266.0",
"6",
"0",
"0.0"
]
}
]
},
{
"dimensions": [
"20200318",
"(not set)",
"India",
"Chrome",
"desktop",
"(direct) / (none)",
"(not set)",
"Tamil Nadu"
],
"metrics": [
{
"values": [
"1",
"2",
"0",
"0",
"20",
"135.0",
"20",
"0",
"0.0"
]
}
]
}
],
"totals": [
{
"values": [
"6",
"7",
"4",
"0",
"137",
"5501.0",
"137",
"0",
"0.0"
]
}
],
"rowCount": 3,
"minimums": [
{
"values": [
"1",
"1",
"0",
"0",
"6",
"135.0",
"6",
"0",
"0.0"
]
}
],
"maximums": [
{
"values": [
"4",
"4",
"4",
"0",
"111",
"5100.0",
"111",
"0",
"0.0"
]
}
],
"isDataGolden": true
}
}
]
}
I Want to convert it and bring it in a form that the column header:dimensions and metric header entries name will become column names and their values,ie data.rows.dimensions and metrics.values become corresponding values
ga:date ga:campaign ga:country ga:browser ga:deviceCategory ga:sourceMedium ga:socialNetwork ga:region ga:users ga:sessions ga:newUsers : (column names)
20200316 (not set) India Chrome desktop (direct) / (none) (not set) Tamil Nadu 1 1 1 :(values)
If you can use an Integration account, I suggest to create a flat file schema with the desired structure, and in the logic app you can convert in xml and then apply the Flat File Encoding.
Otherwise a function app should resolve your issue
I have the following node.js code where I want to extract the value "abc" chosen by user as a name. I get result as undefined when I run this code:
let input= [
{
"param": [
{
"id": "name",
"choice": [
{
"label": "abc",
"value": "abc",
"valueId": "abc"
}
]
},
{
"id": "alias",
"choice": [
{
"label": "dsf",
"value": "dsf",
"valueId": "dsf"
}
]
},
{
"id": "description",
"choice": [
{
"label": "",
"value": "",
"valueId": ""
}
]
},
{
"id": "Key",
"choice": [
{
"label": "K",
"value": "K",
"valueId": "K"
}
]
},
{
"id": "tagKey",
"choice": [
{
"label": "",
"value": "",
"valueId": ""
}
]
},
{
"id": "tagValue",
"choice": [
{
"label": "",
"value": "",
"valueId": ""
}
]
},
{
"id": "multiquantity",
"choice": [
{
"label": "1",
"valueId": "1",
"value": "1"
}
]
}
],
"old": [],
"current": null
}
]
let result = (_.find(input.param, {id: "name"})).choice[0].valueId;
console.log("value"+result);
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.min.js"></script>
Seems that the logic is not able to extract the correct value. I need the output as abc. please help