Showing results for 
Search instead for 
Did you mean: 
Advocate II
Advocate II

Collection using local sql - data types

I have an app that Collects data from a local Gateway SQL table into a Powerapps collection. When I try to add a new row to the collection, I get an error that the data types do not match.


I have narrowed it down to a date field.  If I export the app and view the JSON Entities file, it shows me that when I collect from SQL, the date field has a data type of "lowercase d".  However, when I try to Collect and add a new row to the collection, the data type is "uppercase D".  I have tried many things... changing the datatype in SQL from datetime to: date, datetime2, and dateoffset.  On the PowerApps side, I have tried using the date control's SelectedDate, using a string, using the DateValue of a string.  Obviously the string won't work, but the other two both have a data type of "uppercase D".



When trying to update from Collection inside of PowerApps, this is the data type:


I cannot get anything to update the collection. What am I missing or not understanding?


Any help is greatly appreciated.


Community Support
Community Support

Re: Collection using local sql - data types

Hi @TML,


How do you create the collection within your app?

Further, how do you add a new row to the collection that you created? Could you please share a bit more about the formula within your app?


I have made a test on my side, and don't have the issue that you mentioned.


The error message told that there is a data type mismatch issue within the formula that you use to add a new row to the connection. The DateReporting column is a datetime type column, but the dteReportingDate.SelectedDate formula returns a Date value.


Please take a try to format the date value (dteReportingDate.SelectedDate) that you provided for the DateReporting column into a datetime value, and then check if the issue is solved.


Please take a try to modify your formula as below:



Note: The Collection1 represents the Collection that you created within your app, which collects data from your local Gateway SQL table.


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.
Advocate II
Advocate II

Re: Collection using local sql - data types

When the app's first screen opens, it reads in existing data from the SQL table.  Below is the code:



Later in the app when it is determined that I need to add a row to the Collection, I use this code:

    { FCode: gFCode,
    DateReporting: DateValue(vSelectedDate),
    Room: vRoom,
    HighTemp: vHTemp,
    LowTemp: vLTemp,
    TempSetPoint: vTempSetPt,
    WaterMeterUsage: vWaterUsage,
    Comments: vComments,
    NeedsSync: gNeedsSync

I have also tried using dteReportingDate.Selected date and either way it give me the same outcome.  I have also changed the data type in the SQL column and have tried DateTime, DateTime2, Date, and DateOffset.  All have the same outcome and think their is a data type mismatch.


Advocate II
Advocate II

Re: Collection using local sql - data types

Is there documentation that explains the letter codes for the different data types?

Advocate II
Advocate II

Re: Collection using local sql - data types

I also tried just now using DateValue and the string date, and concatenated a time to it as well and still have the same results.

Advocate II
Advocate II

Re: Collection using local sql - data types

Does this mean no one can answer the question or help me solve the problem?

Regular Visitor

Re: Collection using local sql - data types

Don't know if you are still looking for an answer, but I just recently had this issue and solved it. I have a Gallery full of Jobs that change colors if they are updated with any information. So when a change is made to a Job, it collects the "Job Number" as JOBNUM and a "Work Type" as WRKTYPE in a collection. So I first tried the fill color to read If Lookup(Collection, JOBNUM =Thisitem.Job # & WRKTYPE=ThisItem.Work Type), change to Green. I was getting an Invalid Argument Error stating that Work Types were different data types(I tried Value() and Text() functions and was still unsuccessful). So then I tired collecting  "Job Number&Work Type" as JOBNUM, and when I referenced IF JOBNUM=ThisItem.Job Number&Work Type it worked. Hope that helps. 

Helpful resources

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.


Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,628)