【问题标题】:Implement like button in power apps在电源应用中实现类似按钮
【发布时间】:2021-07-01 22:26:16
【问题描述】:

我正在尝试在 Microsoft 电源应用中实现类似的功能。按下like按钮时遇到问题我收到错误

The type of this argument "LikedBy" does not match the expected type "Record" found type "text" instead. 

我使用的代码是

Patch(
ProposalLikes,
Defaults(ProposalLikes),
{   
    ThemeID: ThisItem.ID,
    Liked: 1,
    LikedBy: User().Email
}

)

我的结构数据列表看起来像

有人知道我为什么会收到这个错误吗?

【问题讨论】:

  • ProposalLikes 是字面上的表格还是集合?当文本对此最有意义时,它会期待记录,这当然很奇怪。
  • 您列表中“喜欢的人”列的类型是什么?并对尼克的上述问题 +1 - ProposalLikes 的类型是什么?根据图像,它看起来像一个 SharePoint 列表,但最好确认一下。

标签: powerapps powerapps-formula


【解决方案1】:

LikedBy 似乎是 Sharepoint 列表中的个人类型列。如果是这样,它是 Record 数据类型,而 User().EmailText 数据类型。使用 User() 修补 Person 类型的列可能很诱人,但架构不匹配。

人型列架构(Sharepoint)

{         
  '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
  Claims:"i:0#.f|membership|user@user.com",
  Department:"",
  DisplayName:"",
  Email:"",
  JobTitle:"",
  Picture:""
}

要修补 Person 类型的列,试试这个:

Patch(
    ProposalLikes,
    Defaults(ProposalLikes),
    {   
        ThemeID: ThisItem.ID,
        Liked: 1,
        LikedBy: 
        {
          '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
           Claims:"i:0#.f|membership|" & User().Email,
           Department:"",
           DisplayName:User().FullName,
           Email:User().Email,
           JobTitle:"",
           Picture:""
        }
    }
)

【讨论】:

    猜你喜欢
    • 2014-06-10
    • 1970-01-01
    • 2022-01-07
    • 1970-01-01
    • 1970-01-01
    • 2019-09-26
    • 1970-01-01
    • 2018-08-20
    • 1970-01-01
    相关资源
    最近更新 更多