cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cnr
Advocate II
Advocate II

Saving a Gallery to an empty table in Dataverse

Hi all,

 

Does anyone know is it possible to save a gallery of items to an empty table in Dataverse?

 

I have generated the items in my Gallery with a ClearCollect. I am now trying to make these records permanent by saving them to an empty table I made in Dataverse. I've been trying to Patch the items through with no success  

 

Many thanks

Conor

4 REPLIES 4
AJ_Z
Super User
Super User

This can definitely be done but just so I can have a bit of understanding and think about the possible performance issues on average how many rows are you expecting in the gallery? could it be a few thousand or is it likely less than that? and does the collection columns come from that datasource whcih you wish to patch to or is it from another source e.g. does the schema match
if it matches we can just Collect(Datasource,Collection) 

In most cases for me it does not match so I have to do:

 

ForAll(CollectionName As RecordtoPatch, Patch(DatasourcebeingPatchedto,Defaults(DatasourcebeingPatchedto),{1stRecordName:RecordtoPatch.Name, Col2:RecordtoPatch.Address,'Column Three':RecordtoPatch.number}))

 

or something like the above to map it out give it a try if you are unsure what i mean provide an example of your patch (e.g. this columns in collection goes to this column name in datasource if you havent wrote a patch) your collection name and the end datasource name it goes to

If you appreciated my comments/responses please be sure to Like/Kudo them it really does make me smile 🙂 !

cnr
Advocate II
Advocate II

Hi @AJ_Z ,

 

Thanks for coming back, this would be for a hew hundred rows max. No the Collect columns I generated with a Clearcollect shown below.

cnr_0-1642167990362.png

This then gives me the Gallery shown below here. I've tried using the the ForAll function to Patch these Gallery items to my empty datasource called "projs" but it gives me an unknown error when I click Update. 

cnr_1-1642168041643.png

 

This is the correct approach right ?

 

Many thanks

RandyHayes
Super User
Super User

@cnr 

In your formula for update, you are referencing controls...not the properties of those controls.

So your formula should look more like this:

Patch(projs,
    ForAll(Gallery4.AllItems,
        {crdfc_int_proj: TexdtInput3.Text,
         crdfc_date_proj: DatePicker3.SelectedDate
        }
    )
)

The above will create new records in your projs table...assuming no other fields are required.

 

Kudos for using the ForAll properly!!!

 

I hope this is helpful for you.

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hi @RandyHayes 

 

Ive tried a few variations of this. I am able to Patch through the ID to the Name field, but cannot patch my interest or the date with the above syntax.

 

Ive split it into 2 Patch functions below, the approach seems to be the exact same to me. The first Patch function works but the 2nd doesn't - Is there something obvious Im missing here?

 

cnr_3-1642425580773.png

 

cnr_1-1642425408499.png

cnr_2-1642425535241.png

 

cnr_0-1642425182319.png

 

Many thanks

Conor

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,388)