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



Signature:


If you appreciated my comments/responses please be sure to Like/Kudo them it really does make me smile 🙂 !
Link to the Power Platform Professionals United Kingdom User Group:

https://powerusers.microsoft.com/t5/Power-Platform-Professionals/gh-p/PowerPlatformProfessionalsUnit...

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 Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

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.

Users online (2,974)