cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
shaneOZ
Level 8

Offline Collection only keeping one entry

Hi My app is only sending one entry when offline back to Sharepoint when reconnected, is it my code?

 

(There is a timer set to check for connection and send to sharepoint) its OnTimerEnd is 

 

If(Connection.Connected, Patch('Haulage Operators Log', Defaults('Haulage Operators Log'),
{Haul_x0020_Truck: Can_haul.Selected,
Activity: Can_Activity.Selected,
to: Can_to.Selected,
From: Can_From.Selected,
Pit: Can_Pit.Selected,
starthours: Value(Can_Starthours.Text),
finishhours: Value(Can_Finishhours.Text)}); Clear(RD18COLLECTION))

 

 

See the submit button below

 

If(Connection.Connected
,Patch('Haulage Operators Log',
Defaults('Haulage Operators Log'),
{
to: Can_to.Selected,
From: Can_From.Selected,
Pit: Can_Pit.Selected,
Activity:Can_Activity.Selected,
Haul_x0020_Truck: Can_haul.Selected,
starthours: Can_Starthours.Text,
finishhours: Can_Finishhours.Text
}
)
,Collect(RD18COLLECTION,
{
to: Can_to.Selected,
From: Can_From.Selected,
Pit: Can_Pit.Selected,
Activity:Can_Activity.Selected,
Haul_x0020_Truck: Can_haul.Selected,
starthours: Can_Starthours.Text,
finishhours: Can_Finishhours.Text
}
)
);
UpdateContext({ResetVar: true});
UpdateContext({ResetVar:false});
Navigate(DetailScreen1, ScreenTransition.None)

1 ACCEPTED SOLUTION

Accepted Solutions
sopatte
Level 8

Re: Offline Collection only keeping one entry

When your timer event happens, you are taking the contents of the controls on the form and writing that as a single record to the 'Haulage Operators Log'. I think what you want on your timer event is to write each record from RD18COLLECTION back to 'Haulage Operators Log'.

If(Connection.Connected,
    ForAll(RD18COLLECTION,
        Patch('Haulage Operators Log',
            Defaults('Haulage Operators'),
            {
                to: to,
                From: From,
                Pit: Pit,
                Activity: Activity,
                Haul_x0020_Truck: Haul_x0020_Truck,
                starthours: starthours,
                finishhours: finishhours

           }

        )

    );
    Clear(RD18COLLECTION)
)

View solution in original post

1 REPLY 1
sopatte
Level 8

Re: Offline Collection only keeping one entry

When your timer event happens, you are taking the contents of the controls on the form and writing that as a single record to the 'Haulage Operators Log'. I think what you want on your timer event is to write each record from RD18COLLECTION back to 'Haulage Operators Log'.

If(Connection.Connected,
    ForAll(RD18COLLECTION,
        Patch('Haulage Operators Log',
            Defaults('Haulage Operators'),
            {
                to: to,
                From: From,
                Pit: Pit,
                Activity: Activity,
                Haul_x0020_Truck: Haul_x0020_Truck,
                starthours: starthours,
                finishhours: finishhours

           }

        )

    );
    Clear(RD18COLLECTION)
)

View solution in original post

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,499)