cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
001
Level: Powered On

Collection is logging each value in its own row.

Collect(
    LogData,
    {
        DateTimePunch: TimeClock.Text,
        Zone: ZoneDropDownList.Selected,
        PunchInOut: PunchSelector.Selected,
        BarcodeID: ScanID.Text
    };
    Reset(TimeClock);
    Reset (ZoneDropDownList);
    Reset(PunchSelector);
    Reset(ScanID)
)

I have a button to make a collection, but when I test it each value has its own row in the collection table. So for one total entry I have four different rows. 


I'm also looking to push the collection to my sharepoint list, is it possible to collect and patch the collection to SPList in the same onSelect Property? 


 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Collection is logging each value in its own row.

Hi @001 ,

Do you want to save your collection data back to your SP List when you press the "Save" button?

 

Firstly, based on the formula you provided, I think there is something wrong with it. Please put your Reset formula outside the Collect function. Modify your formula as below:

Collect(
    LogData,
    {
        DateTimePunch: TimeClock.Text,
        Zone: ZoneDropDownList.Selected,
        PunchInOut: PunchSelector.Selected,
        BarcodeID: ScanID.Text
    }
);
Reset(TimeClock);
Reset(ZoneDropDownList);
Reset(PunchSelector);
Reset(ScanID)

 

If you want to save the collection data back to your SP list data source, I think the ForAll function and Patch function could achieve your needs, please consider take a try with the following workaround:

Set the OnSelect property of the "Save" button to following:

Collect(
    LogData,
    {
        DateTimePunch: TimeClock.Text,
        Zone: ZoneDropDownList.Selected,
        PunchInOut: PunchSelector.Selected,
        BarcodeID: ScanID.Text
    }
);
ForAll( /* <-- Add formula here */
LogData,
Patch(
'YourSPList',
Defaults('YourSPList'),
{
Title: "Sync data from Collection to SP list",
Column1: LogData[@DateTimePunch],
Column2: LogData[@Zone],
Column3: LogData[@PunchInOut],
Column4: LogData[@BarcodeID]
}
)
); Reset(TimeClock); Reset(ZoneDropDownList); Reset(PunchSelector); Reset(ScanID)

Note: The Column1, Column2, Column3 and Column4 represents the corresponding columns in your SP list, which are used to store the column value from your LogData collection.

 

In addition, could you please share more details about the ZoneDropDownList, and PunchSelector in your Collection? Do you want to select single value within the ZoneDropDown box and PunchSelector box? Do you use Choice type columns to store the ZoneDropDownList value and PunchSelector value in your SP list?

 

If you use to store the ZoneDropDownList value and PunchSelector value in your SP list, please consider modify above formula as below:

Set the OnSelect property of the "Save" button to following:

Collect(
    LogData,
    {
        DateTimePunch: TimeClock.Text,
        Zone: ZoneDropDownList.Selected.Value,
        PunchInOut: PunchSelector.Selected.Value,
        BarcodeID: ScanID.Text
    }
);
ForAll( /* <-- Add formula here */
LogData,
Patch(
'YourSPList',
Defaults('YourSPList'),
{
Title: "Sync data from Collection to SP list",
TextColumn1: LogData[@DateTimePunch],
ChoiceColumn1: {
Value: LogData[@Zone]
}
,
ChoiceColumn2: {
Value: LogData[@PunchInOut]
},

TextColumn2: LogData[@BarcodeID]
}
)
); Reset(TimeClock); Reset(ZoneDropDownList); Reset(PunchSelector); Reset(ScanID)

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Dual Super User
Dual Super User

Re: Collection is logging each value in its own row.

Hi @001 

 

Can you try to update the expression as:
Collect(
    LogData,
    {
        DateTimePunch: TimeClock.Text,
        Zone: ZoneDropDownList.Selected,
        PunchInOut: PunchSelector.Selected,
        BarcodeID: ScanID.Text
    }
);
Reset(TimeClock);
Reset (ZoneDropDownList);
Reset(PunchSelector);
Reset(ScanID);
Patch(DataSourceName,Defaults(DataSourceName), 
   {
        DateTimePunch: TimeClock.Text,
        Zone: ZoneDropDownList.Selected,
        PunchInOut: PunchSelector.Selected,
        BarcodeID: ScanID.Text
    }
)
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
001
Level: Powered On

Re: Collection is logging each value in its own row.

Collect(
    LogData,
    {
        DateTimePunch: TimeClock.Text,
        Zone: ZoneDropDownList.Selected,
        PunchInOut: PunchSelector.Selected,
        BarcodeID: ScanID.Text
    };
    
    Reset (ZoneDropDownList);
    Reset(PunchSelector);
    Reset(ScanID);

    Collect('SPlistDataSource', LogData))

So I tried your code to Patch but nothing was added to my sharepoint list. 

I then tried the method above using 'COLLECT'. This didnt work either. 

Dual Super User
Dual Super User

Re: Collection is logging each value in its own row.

Hey @001 

 

Collect is used to create local collection. To update the data in the SP list, you need to use Patch. Which you used the previous expression, did you get any errors? If not, please share the expression that you used and more details about the schema of liat along with the data that you are trying to patch.

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Community Support Team
Community Support Team

Re: Collection is logging each value in its own row.

Hi @001 ,

Do you want to save your collection data back to your SP List when you press the "Save" button?

 

Firstly, based on the formula you provided, I think there is something wrong with it. Please put your Reset formula outside the Collect function. Modify your formula as below:

Collect(
    LogData,
    {
        DateTimePunch: TimeClock.Text,
        Zone: ZoneDropDownList.Selected,
        PunchInOut: PunchSelector.Selected,
        BarcodeID: ScanID.Text
    }
);
Reset(TimeClock);
Reset(ZoneDropDownList);
Reset(PunchSelector);
Reset(ScanID)

 

If you want to save the collection data back to your SP list data source, I think the ForAll function and Patch function could achieve your needs, please consider take a try with the following workaround:

Set the OnSelect property of the "Save" button to following:

Collect(
    LogData,
    {
        DateTimePunch: TimeClock.Text,
        Zone: ZoneDropDownList.Selected,
        PunchInOut: PunchSelector.Selected,
        BarcodeID: ScanID.Text
    }
);
ForAll( /* <-- Add formula here */
LogData,
Patch(
'YourSPList',
Defaults('YourSPList'),
{
Title: "Sync data from Collection to SP list",
Column1: LogData[@DateTimePunch],
Column2: LogData[@Zone],
Column3: LogData[@PunchInOut],
Column4: LogData[@BarcodeID]
}
)
); Reset(TimeClock); Reset(ZoneDropDownList); Reset(PunchSelector); Reset(ScanID)

Note: The Column1, Column2, Column3 and Column4 represents the corresponding columns in your SP list, which are used to store the column value from your LogData collection.

 

In addition, could you please share more details about the ZoneDropDownList, and PunchSelector in your Collection? Do you want to select single value within the ZoneDropDown box and PunchSelector box? Do you use Choice type columns to store the ZoneDropDownList value and PunchSelector value in your SP list?

 

If you use to store the ZoneDropDownList value and PunchSelector value in your SP list, please consider modify above formula as below:

Set the OnSelect property of the "Save" button to following:

Collect(
    LogData,
    {
        DateTimePunch: TimeClock.Text,
        Zone: ZoneDropDownList.Selected.Value,
        PunchInOut: PunchSelector.Selected.Value,
        BarcodeID: ScanID.Text
    }
);
ForAll( /* <-- Add formula here */
LogData,
Patch(
'YourSPList',
Defaults('YourSPList'),
{
Title: "Sync data from Collection to SP list",
TextColumn1: LogData[@DateTimePunch],
ChoiceColumn1: {
Value: LogData[@Zone]
}
,
ChoiceColumn2: {
Value: LogData[@PunchInOut]
},

TextColumn2: LogData[@BarcodeID]
}
)
); Reset(TimeClock); Reset(ZoneDropDownList); Reset(PunchSelector); Reset(ScanID)

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,522)