質問

Is it possible to patch a Data Source, like SharePoint from inside a Component?

I got multiple screens in my app with many fields, clicking save from one screen should save everything from other screens.

I'm trying to have a component with a button so that when I need to do changes to the save functionality I only have 1 place to change and not in all the screens.

役に立ちましたか?

解決

You can't save data sources, forms, and data tables with components.

Source: Create a component for canvas apps - Known limitations

It is an known limitation with Component control in Power Apps. The data source you added in your app could not be recognized within the Component control.

If you want to execute the Patch formula within your Component control, I afraid that there is no way to achieve your needs in Power Apps currently.

Reference: Components - work around no data source access

If you would like this feature to be added in Power Apps, please vote this idea on Power Apps Ideas Forum: Allow access to data source from within components

他のヒント

Ganesh may be overlooking the ability to define custom properties in the component. You can 100% patch a Data Source like SharePoint from inside a Component. For each field you wish to patch (whether it is an insert or update), define an output property.

Then on the app side, your patch command will resemble something similar to the following example (an actual in-production example):

    Patch(
    tblResources,
    LookUp(tblResources, ResourcePK = First(colResource).ResourcePK), 
    {
    Title: 'comResourceInfo-S920'.Title,
    Description: 'comResourceInfo-S920'.Description,
    UNC: 'comResourceInfo-S920'.UNC,
    URL: 'comResourceInfo-S920'.URL,
    Active: 'comResourceInfo-S920'.Active,
    bump: 'comResourceInfo-S920'.Bump,
    RsrcTypeFK: 'comResourceInfo-S920'.RTypeFK,
    ToolFK: 'comResourceInfo-S920'.ToolFK,
    StatusFK: 'comResourceInfo-S920'.StatusFK,
    BPO_L0_FK: 'comResourceInfo-S920'.BPO0,
    BPO_L1_FK: 'comResourceInfo-S920'.BPO1,
    BPO_L2_FK: 'comResourceInfo-S920'.BPO2
})

My component is comResourceInfo. When I add the component to the screen, it is referred to as comResourceInfo-S920. All of the output properties that I defined in the component are available within that element and referred to as shown following the dot notation in the patch function above.

The screen has a save button to execute the patch. And that's is how you patch a Data Source like SharePoint from inside a Component.

ライセンス: CC-BY-SA帰属
所属していません sharepoint.stackexchange
scroll top