【发布时间】:2018-04-06 00:23:48
【问题描述】:
我无法通过 PowerApps 访问集合中的数据。
我用这个创建集合:
Collect(coll15,mt.GetAnswers("3b....da","application/json",{question:"eco"}))
使用开发者工具 -> 网络选项卡 -> 响应正文 - 返回以下 JSON 数据:
{
"answers": [
{
"answer": "This is the answer",
"questions": [
"Private vehicle eco renewal"
],
"score": 82.901087775826454
}
]
}
集合已创建。
然后我将一个画廊控件添加到我的页面 - 但是我必须绑定到标签的唯一选项是:ThisItem.Value
如果我尝试输入 ThisItem.Value.answer 我收到错误:'.' 的使用无效
如果我输入 ThisItem.answers.answer 我会收到错误:名称无效
这是招摇文件:
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "mt",
"description": "mt"
},
"host": "westus.api.cognitive.microsoft.com:443",
"basePath": "/",
"schemes": [
"https"
],
"consumes": [],
"produces": [
"application/json"
],
"paths": {
"/qnamaker/v2.0/knowledgebases/eeeee.....eeeee/generateAnswer": {
"post": {
"summary": "GetAnswers",
"description": "Get answers from qna",
"operationId": "GetAnswers",
"parameters": [
{
"name": "body",
"in": "body",
"schema": {
"type": "object",
"properties": {
"question": {
"type": "string",
"description": "question",
"x-ms-summary": "question",
"title": "question",
"x-ms-visibility": ""
}
},
"default": {
"question": "hi"
},
"required": [
"question"
]
},
"required": true
}
],
"responses": {
"default": {
"description": "default",
"schema": {
"type": "string"
}
}
}
}
}
},
"definitions": {},
"parameters": {},
"responses": {},
"securityDefinitions": {
"api_key": {
"type": "apiKey",
"in": "header",
"name": "Ocp-Apim-Subscription-Key"
}
},
"security": [
{
"oauth2_auth": [
"Offline-Access"
]
}
],
"tags": []
}
我有什么方法可以访问集合中的答案文本吗?
感谢您的帮助,
标记
【问题讨论】:
-
什么是
mt?您创建的自定义连接器还是现有的?如果是自定义连接器,能否分享一下它的 OpenAPI/Swagger 定义? -
嗨 - 是的,它是一个自定义连接器。我在web.powerapps.com 中创建了它 - 我看不到如何下载 swagger 文件。能不能给点建议?
-
如果您访问 web.powerapps.com,然后选择数据 --> 自定义连接器,您应该会看到您拥有的连接器列表,然后从那里下载 swagger。有关详细信息,请参阅imgur.com/a/RS93P。请记住,如果您共享 swagger 文件,请删除您不想共享的所有密钥/密码/信息。操作/对象定义可能是您遇到问题的地方。
-
谢谢卡洛斯 - 我已将 swagger 文件添加到我的问题中 - 我不确定我需要更改什么(如果有的话)。