cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dalacarelia_196
Helper IV
Helper IV

Removing post from gallery wit multiple datasources


In my Gallery i can use Swicth do sort out my database to pick data from
SortByColumns(Filter(Switch(ddSkolvaljaren.SelectedText.Value ;
"YG A";YG2001AH;
"YG B";YG2002AH;
"YG C";YG2003AH;
"YG D";YG2004AH;
"YG E";YG2012AH ); StartsWith(Fullname_pedagog; TextSearchBox1_1.Text)); "Created"; If(SortDescending1; Descending; Ascending))
 
And  i have an removing post icon and i been trying to do the same there but it dosent work out
This works Remove(YG2001AH;ThisItem) so i have tor use the hard code . I trying to use like this But not working
pict1.PNG
 
 
 
Remove(Switch(ddSkolvaljaren.SelectedText.Value ;
"YG A";YG2001AH;
"YG B";YG2002AH;
"YG C";YG2003AH;
"YG D";YG2004AH;
"YG E";YG2012AH );ThisItem)
There is no complian on the code but after test it the red dot , hopefully i am near the solution any tips 
pict2.PNG
 
 
1 ACCEPTED SOLUTION

Accepted Solutions
mdevaney
Super User III
Super User III

@dalacarelia_196

PowerApps will not let you write a SWITCH statement that way because ThisItem has the potential to be different for each datasource.  Instead, you must do it the longer way...

 

Switch(
  ddSkolvaljaren.SelectedText.Value ;
  "YG A"; Remove(YG2001AH; ThisItem);
  "YG B"; Remove(YG2002AH; ThisItem);
  "YG C"; Remove(YG2003AH; ThisItem);
  "YG D"; Remove(YG2004AH; ThisItem);
  "YG E"; Remove(YG2012AH; ThisItem)
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

2 REPLIES 2
mdevaney
Super User III
Super User III

@dalacarelia_196

PowerApps will not let you write a SWITCH statement that way because ThisItem has the potential to be different for each datasource.  Instead, you must do it the longer way...

 

Switch(
  ddSkolvaljaren.SelectedText.Value ;
  "YG A"; Remove(YG2001AH; ThisItem);
  "YG B"; Remove(YG2002AH; ThisItem);
  "YG C"; Remove(YG2003AH; ThisItem);
  "YG D"; Remove(YG2004AH; ThisItem);
  "YG E"; Remove(YG2012AH; ThisItem)
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

Thank you this is om nice it works .

Perfect solution. 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (56,555)