web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Update Sharepoint Libr...
Power Apps
Answered

Update Sharepoint Library if Exists, if not create new item

(0) ShareShare
ReportReport
Posted on by 71
Hi All
 
Really hoping I can get some help, I am going crazy with this.
 
I have a Sharepoint List, as the database for 2 seperate galleries (Each one has a filter for Bob or Gaj) which are nested in a larger gallery(This is a simple Month Calendar ForAll Sequence), the issue I have is I am unable to select the nested gallery item as the gallery.selected.value. as the dropdown control does not exist in the 2 nested galleries. I have this semi working that when an item is existing it will update the value appropriately, specifically the value in the calendar item in the blue square. However it will not "Create" a new entry in the specific "Day" entry.
 
 
Here is the "Onchange" property of the Dropdown,

"
If(
    IsBlank(
        LookUp(
            'Course Calendar',
            'Class RN' = gal_Calendar_Events_3.Selected.'Class RN' & 'Course Start Date' = ThisItem.Value
        )
    ),
    Patch(
        'Course Calendar',
        LookUp(
            'Course Calendar',
            'Class RN' = gal_Calendar_Events_3.Selected.'Class RN' & 'Course Start Date' = ThisItem.Value
        ),
        {
            'Assessor Status': DropdownCanvas3_1.Selected.Value,
            'Course Name': DropdownCanvas3_1.Selected.Value,
            Assessor: {Value: "Gajender"},
            'Off Date': ThisItem.Value,
            'Course Start Date': ThisItem.Value,
            'Course End Date': ThisItem.Value
        }
    ),
    Patch(
        'Course Calendar',
        {
            'Assessor Status': DropdownCanvas3_1.Selected.Value,
            'Course Name': DropdownCanvas3_1.Selected.Value,
            Assessor: {Value: "Gajender"},
            'Off Date': ThisItem.Value,
            'Course Start Date': ThisItem.Value,
            'Course End Date': ThisItem.Value
        }
    )
);
Refresh('Course Calendar')
"
 
Any help would be massively appreciated!
I have the same question (0)
  • Verified answer
    mmbr1606 Profile Picture
    14,605 Super User 2025 Season 2 on at
    hey
     
    can  try this :
    Set(varItemToFindOrCreate,
        LookUp(
            'Course Calendar',
            'Class RN' = gal_Calendar_Events_3.Selected.'Class RN' And 'Course Start Date' = ThisItem.Value
        )
    );
    
    If(
        IsBlank(varItemToFindOrCreate),
        Collect(
            'Course Calendar',
            {
                'Assessor Status': DropdownCanvas3_1.Selected.Value,
                'Course Name': DropdownCanvas3_1.Selected.Value,
                Assessor: {Value: "Gajender"},
                'Off Date': ThisItem.Value,
                'Course Start Date': ThisItem.Value,
                'Course End Date': ThisItem.Value
            }
        ),
        Patch(
            'Course Calendar',
            varItemToFindOrCreate,
            {
                'Assessor Status': DropdownCanvas3_1.Selected.Value,
                'Course Name': DropdownCanvas3_1.Selected.Value,
                Assessor: {Value: "Gajender"},
                'Off Date': ThisItem.Value,
                'Course Start Date': ThisItem.Value,
                'Course End Date': ThisItem.Value
            }
        )
    );
    
    Refresh('Course Calendar');
    
    cheers
  • Sirbatchu Profile Picture
    71 on at
    You sir are a genius
     
    it 100% works.
     
    The only issue I have now is the time it is taking to "Refresh" good 5 or 6 seconds.
     
    Not sure if there is anything I can do about this, as technically its refreshing around 60 "Nested" galleries at once.

    Any ideas, but thank you so much for the resolution this has done it!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard