cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Super User
Super User

Re: Saving Data to Excel

Thank you for sharing the picture of your data. That is quite helpful.

 

So, three questions:

First, how are you selecting a record to edit it? A gallery, dropdown, combo box, etc.?

Second, could you share the statement you are using to edit data? 
And third, is the 'Growout ID' unique to each row of data?

 

 

 

 

Highlighted
Helper II
Helper II

Re: Saving Data to Excel

So, three questions:

 

First, how are you selecting a record to edit it? 

 

1) I attached the screenshots with the steps that I use to edit the Farms which saves it to a collection called Farms

 

Second, could you share the statement you are using to edit data? 

 

2) I sent the screenshots

 

And third, is the 'Growout ID' unique to each row of data?

 

3) Yes the growout ID is unique to each Farm

Highlighted
Helper II
Helper II

Re: Saving Data to Excel

2) This is the code for the edit button:

 

EditForm(EditForm1);Navigate(EditScreen1, ScreenTransition.None)

Highlighted
Super User
Super User

Re: Saving Data to Excel

Thank you for the info. Very helpful! It seems like the steps you are taking are correct to ensure that your form is in Edit mode. Just to check my understanding, is the "Collect Offline" a button that takes the form's data and saves it to upload later? If so, what do you have in the OnSelect property?

Highlighted
Helper II
Helper II

Re: Saving Data to Excel

The collect offline has the following:

 

Collect(Farms, {Farm:DataCardValue11.Text, Growout:DataCardValue13.Text,DatePlaced:DateValue1.SelectedDate, Age:DataCardValue9.Text, QtyPlaced:DataCardValue16.Text,Feed:DataCardValue12.Text, LOU:DataCardValue14.Text, MTD:DataCardValue15.Text, Weight:DataCardValue17.Text, TARWeight:DataCardValue18.Text,PDF:DataCardValue19.Text, Comments:DataCardValue10.Text});Navigate([@OfflineData], ScreenTransition.None)

 

 

Highlighted
Super User
Super User

Re: Saving Data to Excel

Okay, we are getting there. Thanks for sticking in here with me as I try to wrap my head around your app! 

 

Is the Farm collection only used for edited records or do you use it for new records as well? And once you have records ready to upload, what code are you using to upload them?

 

If the Farm collection is only being used for edited records, you could use something like the following:

ForAll(
    Farm,
    Patch(
        farm // This is the name of the Excel table, right?
        LookUp(
            farm, 
            'Growout ID' = Farm[@'Growout ID']
        ),
        {
            Age: Farm[@Age],
            'Farm Name': Farm[@'Farm Name'],
            'Date Placed': Farm[@'Date Placed'],
            'Date Placed': Farm[@'Date Placed'],
            'Qty Placed': Farm[@'Qty Placed'],
            Weight: Farm[@Weight],
            'Target Wt': Farm[@'Target Wt'],
            LOU%: Farm[@LOU%],
            MTD: Farm[@MTD],
            Feed: Farm[@Feed],
            PDF: Farm[@PDF],
            Comments': Farm[@Comments]
        }
    )
)

This loops through the Farm collection and patches (edits) records in the farm Excel table that match each Growout ID with the respective values stored in the collection.

 

Highlighted
Helper II
Helper II

Re: Saving Data to Excel

Hi,

 

The name of the excel table is Table2 and the name of the collection is Farms

Highlighted
Super User
Super User

Re: Saving Data to Excel

Thanks for the correction! The code would then look like:

ForAll(
    Farms,
    Patch(
        Table2
        LookUp(
            Table2, 
            'Growout ID' = Farms[@'Growout ID']
        ),
        {
            Age: Farms[@Age],
            'Farm Name': Farms[@'Farm Name'],
            'Date Placed': Farms[@'Date Placed'],
            'Date Placed': Farms[@'Date Placed'],
            'Qty Placed': Farms[@'Qty Placed'],
            Weight: Farms[@Weight],
            'Target Wt': Farms[@'Target Wt'],
            LOU%: Farms[@LOU%],
            MTD: Farms[@MTD],
            Feed: Farms[@Feed],
            PDF: Farms[@PDF],
            Comments': Farms[@Comments]
        }
    )
)
Highlighted
Helper II
Helper II

Re: Saving Data to Excel

Do I need to change anything?

Highlighted
Super User
Super User

Re: Saving Data to Excel

If the Farms collection is only used for edited records, my provided code should take care of uploading them. If it is being used for both new and edited records, some changes would be needed. 

 

Is it only used for edited records?

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 (10,586)