PowerApps无法将集合打补丁为表格

问题描述

我的补丁程序功能出现问题。我看到的唯一错误是当我提供表时,它期望记录。这是因为集合以表的形式返回,并且我需要通过ForAll遍历集合的行吗?我以为集合中的ForAll()会做到这一点。还有其他想法吗?

注意:“我的SharePoint列表”中确实还有其他列,但是我仅在此图库中更新其中的几列...。这是引起此问题的原因吗?

// Create a collection to store updated values
ForAll(
    Filter(
        gal_EditableTable.AllItems,tog_isChanged.Value
    ) As ChangedRows,Patch(colUpdates,Defaults(colUpdates),{
        ID: ChangedRows.ID,ItemNumber: ChangedRows.txt_ItemNumber.Text,Description: ChangedRows.txt_Description.Text,Quantity: Value(ChangedRows.txt_Quantity.Text),Location: ChangedRows.txt_Location.Text
    })
);

// Update SharePoint with new values
Patch('Inventory Count',colUpdates);
Clear(colUpdates);

解决方法

要直接将集合Patch ForAll( Filter( Gallery1.AllItems,Toggle1.Value = true ) As ChangedRows,Patch('Inventory Count',Defaults('Inventory Count'),{ itemNumber: ChangedRows.itemNumber,desc: ChangedRows.desc,qty: ChangedRows.qty } ) ) 到Sharepoint列表,要修补的列必须完全相同;名称和数据类型。

想知道是否可以做:(添加新记录)

ForAll(
    Filter(
        Gallery1.AllItems,LookUp('Inventory Count',id = ChangedRows.id),qty: ChangedRows.qty
        }
    )
)

或者这样:(要更新现有记录)

{{1}}