Skip to main content

Notifications

Power Apps - Power Apps Pro Dev & ISV
Answered

Update Sharepoint Library if Exists, if not create new item

Posted on 4 Dec 2024 10:14:45 by 56
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!
  • Sirbatchu Profile Picture
    Sirbatchu 56 on 04 Dec 2024 at 11:25:16
    Update Sharepoint Library if Exists, if not create new item
    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!
  • Verified answer
    mmbr1606 Profile Picture
    mmbr1606 9,972 on 04 Dec 2024 at 10:54:45
    Update Sharepoint Library if Exists, if not create new item
    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

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,372

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,900

Leaderboard