cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Prodigy
Post Prodigy

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
Highlighted
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
Highlighted
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!

 

Highlighted
Post Prodigy
Post Prodigy

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.

Highlighted
Post Prodigy
Post Prodigy

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

Highlighted
Community Support
Community Support

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.
Highlighted
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

Highlighted
Post Prodigy
Post Prodigy

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

Highlighted
Community Support
Community Support

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.
Highlighted
Post Prodigy
Post Prodigy

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
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (12,219)