Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
cryptosun
Helper I
Helper I

Urgent Help ! Issue with PowerAPPS Comment Submission In PowerBI report Please HELP!!

Dear Experts, I would be grateful for your help.

 

I am facing an issue with the Patch function, I have a use case in which I have a connected a power app in a power bi report

Where the PowerAPP is being used to take the comments, I am using the patch function to fetch the data from power bi to power apps and then I have added a text input column to get the comments.

 

It is working fine, but even if there is a second comment on a specific material no, it is creating another row, what I want is, that once a comment is submitted, and if there is any previous comment it should update it with the recent comment.

 

If there is no comment, then it should save the comment as it is, in the SharePoint list.

 

I have been trying to do it since many days but i have unable to do it.

 

PS: i am using a gallery to show the data and to take the comments.

This is the code i am using to patch the data from PowerBI to Powerapps and then to submit the comments in the Sharepoint list.

Patch(SharepointlistName,{Title:"1", Commentcolumn:TextInput2.Text,MaterialColumn:ThisItem.MATERIALColumn, PLANNER_CD:ThisItem.PLANNER,


MAT_DESC:ThisItem.DESC_EN,BUS_LINE:ThisItem.BUS_LINE});Navigate(Screen2,ScreenTransition.None)

1 REPLY 1
ChrisMendoza
Resident Rockstar
Resident Rockstar

@cryptosun - You should be checking to see if your 'key' exists in your SharePoint list before you patch. It would look somthing like:

If(
    ThisItem.softwareTermId in colSoftwareTermsUpdates.softwareTermId,
    Update(
        colSoftwareTermsUpdates,
        LookUp(
            colSoftwareTermsUpdates,
            softwareTermId = ThisItem.softwareTermId
        ),
        {
            softwareTermId: ThisItem.softwareTermId,
            softwareTermStart: dte_Software_StartDate.SelectedDate,
            softwareTermEnd: dte_Software_EndDate.SelectedDate,
            softwareTermCost: Value(txt_Software_Cost.Text),
            softwareTermSoftwareId: CurrentItem.softwareId
        }
    ),
    Collect(
        colSoftwareTermsUpdates,
        {
            softwareTermId: ThisItem.softwareTermId,
            softwareTermStart: dte_Software_StartDate.SelectedDate,
            softwareTermEnd: dte_Software_EndDate.SelectedDate,
            softwareTermCost: Value(txt_Software_Cost.Text),
            softwareTermSoftwareId: CurrentItem.softwareId
        }
    )
)

*I'm using a collection in the OnChange event. Reza Dorrani explains this technique at Power Apps Editable Table/Gallery like Excel (Tutorial) - YouTube






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.