cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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
Highlighted
Community Support
Community Support

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
Highlighted
Dual Super User III
Dual Super User III

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!
Highlighted
Frequent Visitor

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. 

Highlighted
Dual Super User III
Dual Super User III

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!

Highlighted
Community Support
Community Support

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
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

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 (8,067)