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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Delete item from SP li...
Power Apps
Answered

Delete item from SP list, using different datasources (calendars).

(0) ShareShare
ReportReport
Posted on by 29

Hey all.

I have created a custom Calendar app linked to 30 SP-lists (different calendars for conference rooms - without Outlook-connector).

After selecting the right calendar, the variable 'CaltoUse' is set to 'Calendar#' - ex Set(CaltoUse,Calendar1).

In the CalenderEventsGallery on the next screen I use for 'Items' the Switch-function to connect to the corresponding calendar (SPlist 'Cal#') - ex. Switch(CaltoUse, "Calendar1",Cal1,"Calendar2",Cal2).

In every datacard I have an Icon (icnDelete) and I want to delete the selected record when pressed. 

 

Question: what is the right formula to achieve this?

 

Remove (Cal1, ThisItem) works, but I want to implement the right calendar, depending on the variable CaltoUse.

Remove (Switch(CaltoUse, "Calendar1",Cal1,"Calendar2",Cal2), ThisItem) doesn't work.

Any ideas?

Thanks in advance

Categories:
I have the same question (0)
  • v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @Verlet ,

     

    Please change to use If() function, instead of Switch(), like this.

    If(CaltoUse="Calendar1",Remove(Cal1,ThisItem),CaltoUse="Calendar2",Remove(Cal2,ThisItem))

    Hope this helps.

    Sik

  • Verified answer
    Verlet Profile Picture
    29 on at

    Hey, as I have 30+ calendars, 'IF' would be hard to create. But, you made me realise that I needed to put the Remove in the Switch function and not the other way.

    So I have: Switch(CaltoUse; "Calendar1";Remove(Cal1;ThisItem);"Calendar2";Remove(Cal2;ThisItem);"Calendar3";Remove(Cal3;ThisItem) ...) and it works!

    Thanks for the help in rearranging the statements!

  • v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @Verlet ,

     

    Of course, the Switch() function is the first choice, but it still can't work in my test, so I changed to use If function.

    Anyway, it helps, right.

    Sik

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 541

#2
WarrenBelz Profile Picture

WarrenBelz 434 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 289

Last 30 days Overall leaderboard