cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
karimabdelrazek
Resolver I
Resolver I

Overwrite entire columns of table with gallery items

Hi,

I have gallery that contains two columns, one for process steps, and the other is their sequence numbers. I'd like to overwrite the entire columns of an existing table (same structure), with the entire contents of this gallery. How can I do that?

I'm only using CDS and no external lists (e.g. SP, etc.). I'm looking for a solution that does not require using external data sources. Many thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

You can Patch the Gallery or the Collection using following;

Gallery:
ForAll(Gallery1.AllItems, Patch(
Datasource,
Defaults(Datasource),
{Column1: Title},
{Column2: Category}))

 

For a collection;

ForAll(Collection1,
Patch(Datasource, Defaults(Datasource), {Column1: Title,
Column2: Category}))

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

6 REPLIES 6
eka24
Super User
Super User

Overwrite gives an indication of replacing the data in the Gallery. To get the structure of the Table use ClearCollect;

ClearCollect (ColOverwrite, Datasource);

Clear (ColOverwrite)

 

That gives an empty structure. Now what do you want to put into the Table structure

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

@eka24 . Sorry if the message wasn't clear. I want to take all the items in the gallery, and write it into an existing CDS entity/ table that contains data.

You can Patch the Gallery or the Collection using following;

Gallery:
ForAll(Gallery1.AllItems, Patch(
Datasource,
Defaults(Datasource),
{Column1: Title},
{Column2: Category}))

 

For a collection;

ForAll(Collection1,
Patch(Datasource, Defaults(Datasource), {Column1: Title,
Column2: Category}))

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

@eka24 . The formula you gave partially works. It writes all the data to the correct columns in my entity, but instead of overwriting, it's adding them as records. Is there a way to overwrite the data in the entity?

@eka I've found the answer. I removed all the values from that entity using the "Remove" function, and re-wrote all the values from gallery into it.

Thanks for your help!

Hi @karimabdelrazek :

Is your problem solved? Do you still need help?

If you have found a solution, could you mark it as a solution so that more people can see it.

Best Regards,

Bof

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,460)