cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
PytByt
Level 8

Remove records from CDS Gallery when the records is already stored in SP list

Hi all..

 

I have a situation here, just like mentioned in the title.

 

So, i have this:
Gallery1 = display data from CDS Entities (Service Order Number)

SPList1 = store data from a Form1 which its record came from the CDS in Gallery 1

Form1 = get some data from the CDS (Gallery1.Selected) which is Service Order Number and a few checklist

 

Condition i want to achieve with powerapps:
If the Form1 is already submitted with the Service Order Number from CDS (Gallery1.Selected) and store all the data in SPList1, Then Remove the record with that Service Order Number from Gallery1.

 

Now, is this condition can be achieve with only using powerapps? how?

Please help me.

 

BR,

pytbyt

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Remove records from CDS Gallery when the records is already stored in SP list

@PytByt 

 

What kind of records are you able to see(logical description) but are not expected in your code?
 
I am guessing it is the first record where status is closed, this might occur because of the OR condition, where even though status is not satisfied but the Service Order Number might not occur in '_Inspection Checklist 1'.
 
If you want to filter the records based on status and the second SP list entries, you may need to modify your formula as:
SortByColumns(Search(Filter('D365FO ServiceOrderHeaders', Or(Stage = "Open",Stage = "Approved",Stage = "Complete") && !('Service Order Id' in '_Inspection Checklist 1'.'Service Order No.')), TextInputSearch1.Text, "cre83_serviceorderid"), "cre83_serviceorderid", Ascending)
 
While for removing the entry from CDS/ Gallery COntrol, you can use either of the formula based on the expressions provided above:
Remove(CDSDataSource, 'Service Order Number' = Gallery1.Selected.'Service Order Number');Refresh(CDSDataSource)
 
or Hide from Gallery:
Filter(CDSDataSource, !('Service Order Number' in SPListDataSource.'Service Order Number'))
 
If this differs from what is expected, please share more details on the logical implementation of your gallery control. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

8 REPLIES 8
Dual Super User
Dual Super User

Re: Remove records from CDS Gallery when the records is already stored in SP list

Hey @PytByt 

 

Do you want to remove the record from CDS once the data is saved using Form1 to SharePoint, if so can you try to update the OnSuccess property of your Edit Form as:
Remove(CDSDataSource, 'Service Order Number' = Gallery1.Selected.'Service Order Number');Refresh(CDSDataSource)
If you just want to filter the gallery records in such a way where all the Service Order Number that exists in SharePoint are not displayed, you can use this below expression on the Items property of your gallery control:
Filter(CDSDataSource, !('Service Order Number' in SPListDataSource.'Service Order Number'))
Here, CDS DataSource refers to the name of CDS DataSource with a column 'Service Order Number' and SPListDataSource is the SharePoint list with an attribute 'Service Order Number'. Replace the used names with the actual names of attributes.

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

 

PytByt
Level 8

Re: Remove records from CDS Gallery when the records is already stored in SP list

Hey yo @yashag2255 

Im very grateful for your reply.

 

Both ways seems good for me. 

This is the first time im working with the CDS and powerapps’s entities. So, is there any way i can use them like the way i does with sharepoint list?

 

Also, can i manipulates it more than a sharepoint? ie. Attachment capabilities.

 

Thanks,

pytbyt.

PytByt
Level 8

Re: Remove records from CDS Gallery when the records is already stored in SP list


@yashag2255 wrote:

Hey @PytByt 

 

If you just want to filter the gallery records in such a way where all the Service Order Number that exists in SharePoint are not displayed, you can use this below expression on the Items property of your gallery control:
Filter(CDSDataSource, !('Service Order Number' in SPListDataSource.'Service Order Number'))

Hi @yashag2255 

 

I modified your formula and add to the one above to something like this:
SortByColumns(Search(Filter('D365FO ServiceOrderHeaders', Stage = "Open" || Stage = "Approved" || Stage = "Complete" || !('Service Order Id' in '_Inspection Checklist 1'.'Service Order No.')), TextInputSearch1.Text, "cre83_serviceorderid"), "cre83_serviceorderid", Ascending)

 

I put the formula in the Gallery1 Items Property.
However, is not working (in my opinion) because, i still see those item that suppose not to be there in the gallery.

 

cds gal 2.png

 

Why is that? what went wrong?

Please help.

 

Regards,

pytbyt

Community Support Team
Community Support Team

Re: Remove records from CDS Gallery when the records is already stored in SP list

Hi @PytByt ,

Could you please share a bit more about your scenario?

Do you want to remove the record with same Service Order Number from your Gallery1 when the Form1 submitted a record into your SP list successfully?

Does the Form1 connect to your SPList1?

 

I assume that the Form1 that you mentioned is connected to your SPList1, and you populate the fields in your Form1 with data from the selected item in your Gallery1, is it true?

 

Based on the needs that you mentioned, I think the OnSuccess property of the Form1 could achieve your needs. Please consider set the OnSuccess proeprty of the Form1 to following:

Remove(
              'YourCDSEntity',
               LookUp('YourCDSEntity', 'Service Order Number' = Gallery1.Selected.'Service Order Number')
);
Refresh('YourCDSEntity')

Note: The 'Service Order Number' represents the column in your CDS Entity.

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Dual Super User
Dual Super User

Re: Remove records from CDS Gallery when the records is already stored in SP list

@PytByt 

 

What kind of records are you able to see(logical description) but are not expected in your code?
 
I am guessing it is the first record where status is closed, this might occur because of the OR condition, where even though status is not satisfied but the Service Order Number might not occur in '_Inspection Checklist 1'.
 
If you want to filter the records based on status and the second SP list entries, you may need to modify your formula as:
SortByColumns(Search(Filter('D365FO ServiceOrderHeaders', Or(Stage = "Open",Stage = "Approved",Stage = "Complete") && !('Service Order Id' in '_Inspection Checklist 1'.'Service Order No.')), TextInputSearch1.Text, "cre83_serviceorderid"), "cre83_serviceorderid", Ascending)
 
While for removing the entry from CDS/ Gallery COntrol, you can use either of the formula based on the expressions provided above:
Remove(CDSDataSource, 'Service Order Number' = Gallery1.Selected.'Service Order Number');Refresh(CDSDataSource)
 
or Hide from Gallery:
Filter(CDSDataSource, !('Service Order Number' in SPListDataSource.'Service Order Number'))
 
If this differs from what is expected, please share more details on the logical implementation of your gallery control. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

PytByt
Level 8

Re: Remove records from CDS Gallery when the records is already stored in SP list

Hi @v-xida-msft  and @yashag2255 

Thank you very much for your replies. 

This community is helping me a lot. And i'm grateful for that.

 

I'm gonna try all that solution you all gives me, Thanks a million.

 

Cheers,

pytbyt

Community Support Team
Community Support Team

Re: Remove records from CDS Gallery when the records is already stored in SP list

Hi @PytByt ,

Have you solved your problem?

 

If you have solved your probem, please go ahead to click "Accept as Solution" to identify this thread has been solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
PytByt
Level 8

Re: Remove records from CDS Gallery when the records is already stored in SP list

Hello @v-xida-msft 

 

Thanks for the reminder,

I still wait for the data for me to process. 

 

But, for time being, i already mark a solution.

 

Thanks,

pytbyt

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (10,780)