有点新手:PowerApps 用构造的数据字段填充列表

问题描述

更新...

尝试通过 PowerApps 将一系列行注入 SharePoint 列表,但遇到这样一个事实,即 PowerApps 似乎只有 FORALL 作为循环函数,并且不支持 SET。

   Set(AlertString,""); // to be used later
   Set(REQ_Value,"");
   Set(RITM_Value,"");
   Set(Asset_Value,"");
   Set(CustomerSignatureFileLocation_Value,"File location: ");
   Set(LoanerKitCode_Value,"");
   Set(IncidentCode_Value,"");
   Set(TransferOrderCode_Value,"");
   Set(TransactionType_Value,Workflow.SelectedText.Value & " - " & Workflow_Steps.SelectedText.Value);
   Set(ScanItemCodeType,"");
   Set(ErrorString,"");
   Collect(ScanDataCollection,Split(ScanData.Text,Char(10))); // Split the data into ScanDataCollection collection
   ForAll(
       ScanDataCollection,If(Left(Result,4)="RITM",Set(RITM_Value,Result); // FAIL HERE
       Collect('Spider - Master Transaction List',{
           REQ: REQ_Value,RITM: RITM_Value,Scan_Code: Result,Asset: Asset_Value,Transaction_Type: TransactionType_Value,Timestamp: Now(),Agent_Name: User().FullName,Agent_Email: User().Email,Agent_Location: DD_Location.SelectedText.Value,Agent_Notes: "It was weird,man.",Customer_Name: Cust_Name.Text,Customer_Email: Cust_NTAccount.Text,Customer_Signature: CustomerSignatureFileLocation_Value,Task_Name: "",Task_Action: "",State_Name: "",State_Action: "",Stage_Name: "",Stage_Action: "",Work_Note_String: "",Customer_Note_String: "",Loaner_Kit_Code: LoanerKitCode_Value,Incident: IncidentCode_Value,Transfer_Order_Code: TransferOrderCode_Value,Item_Description: ""});
   );

我的扫描仪工具将在同一次扫描中获取各种不同类型的项目扫描。根据它是什么类型的数据,它会填充 Spider - Master Transaction List 中的不同列。

但是我们禁止在 FORALL 中使用 SET 函数

考虑到来自 SPLIT 的每条数据都可能是任何类型的代码(例如 RITM 代码、REQ 代码、转移指令代码等),您建议我如何处理?

解决方法

您可以通过各种方式实现您想要的。

使用 Collection 或 Gallery,在 powrapps 中,Galleries 可以像集合一样使用。

我建议:

ForAll(
  Gallery.Allitems,Patch(
   'SharepointListName',ThisRecord
  )
);

图库中的字段必须与共享点列表具有相同的名称,否则您必须创建一个记录来分配名称。

{sharepoitColumnName: ThisRecord.ColumnName,...}