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

Converting data types using Patch to a SharePoint list

I have a simple Patch function that writes the contents of a Collection ("DowntimeRecords") to a SharePoint list ("DowntimeDB"). I am having issues with converting data types to fit to write the Collection to the list. The problem is highlighted below:

 

ForAll(
DowntimeRecords,
Patch(
   DowntimeDB,
     {
       'Business Area': BusAreaColl,
       Country: CountryColl,
       Location: LocationColl,
       'Affected System': AffectedSystemColl,

       'Start Date': StartDateColl,

       'End Date': EndDateColl,

       TotalHoursNew: TotalHoursColl
      }
    )
);
Clear(DowntimeRecords);

 

Start Date and End Date are trying to write type Text to a Date type column in SharePoint, but won't allow it. TotalHoursNew is type Text trying to be written to a Number type column. I have researched how to solve this but I have not found the solution online. Any help with converting these Collection columns to the correct data type needed for the SharePoint list would be appreciated. 

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Converting data types using Patch to a SharePoint list

HI @Mark123 

 

Can you please update your expression as:
ForAll(
DowntimeRecords,
Patch(
   DowntimeDB,
     {
       'Business Area': BusAreaColl,
       Country: CountryColl,
       Location: LocationColl,
       'Affected System': AffectedSystemColl,

       'Start Date': DateValue(StartDateColl),

       'End Date': DateValue(EndDateColl),

       TotalHoursNew: Value(TotalHoursColl)
      }
    )
);
Clear(DowntimeRecords);
This will do the conversions properly.
 
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!
 
2 REPLIES 2
Super User
Super User

Re: Converting data types using Patch to a SharePoint list

HI @Mark123 

 

Can you please update your expression as:
ForAll(
DowntimeRecords,
Patch(
   DowntimeDB,
     {
       'Business Area': BusAreaColl,
       Country: CountryColl,
       Location: LocationColl,
       'Affected System': AffectedSystemColl,

       'Start Date': DateValue(StartDateColl),

       'End Date': DateValue(EndDateColl),

       TotalHoursNew: Value(TotalHoursColl)
      }
    )
);
Clear(DowntimeRecords);
This will do the conversions properly.
 
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!
 
Mark123
Level: Powered On

Re: Converting data types using Patch to a SharePoint list

Thank you @yashag2255! Exactly what I was looking for.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 90 members 4,243 guests
Please welcome our newest community members: