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

Date NOT Showing or WRONG Date Shown

HI PG @CarlosFigueira

 

With reference to your thread, I am still not able to resolve. Can you help! TQ

https://community.powerapps.com/t5/Connectors/Collection-saving-fields-as-objects/td-p/91094

 

I connect my apps to a custom connector and is able to show ALL fields, except "Date". (the field is called "registration_date")

I use:

- Data Table: it shows TODAY's date instead of actual registration date

- Gallery: it shows either "Blank" (Nothing) or [Object][Object].

 

When I refer to the actual data, date is just in a simple format:

registration_date = "28-01-2018".

(I consulted the creator of Custom Connector, my friend, @taufiksu, Android apps can show date without problem.)

 

Attached are the screenshot for

- Strange results from PowerApps

- JSON Viewer of the original data showing correct registration_date.

 

Can PowerApps verify what goes wrong with this!

I formatted using:

- Text(......., "dd-mm-yyyy") and many other styles

- DateValue(,....)

and ALL FAILED.

 

Screenshot (269).pngregistration_date is shown as DATE formatScreenshot (270).pngData Table and Gallery show different resultsjson.pngJSON Viewer shows correct Date

 

Please help.

 

TQ 

2 ACCEPTED SOLUTIONS

Accepted Solutions
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Date NOT Showing or WRONG Date Shown

How is the registration_date property defined in the custom connector Open API specification? If it's defined as a date property (type: string, format: date), then the wire format is incorrect, which is one reason why PowerApps wouldn't be able to understand it. According to the spec, date properties need to have the yyyy-mm-dd format, and in your case it has the dd-mm-yyyy format.

 

If this is the case, then there are a couple of things you can do:

- Remove the format property from the OpenAPI specification - in this case the field will be read in PowerApps as a string, and after that you can convert it to a date using the DateValue function (passing a parameter one of the locales where the format is dd-mm-yyyy, such as "es-ES").

- Update the API that is referenced by the custom API to return the date in the yyyy-mm-dd format.

View solution in original post

Super User
Super User

Re: Date NOT Showing or WRONG Date Shown

Hi @PK_Hong

 

The file that you need to modify is a copy of your OpenAPI specification, rather than the data in the link.

 

The first step is to find your custom connector in the portal.

custconn1.JPG

 

Click the download icon (highlighted) and save the file onto your computer.

 

Open the downloaded file in your text editor of choice. Within the file, search for the definition of registration_type. It'll look something like this:

 

"properties": {
   "registration_type": {
       "type": "date",

Change the type from "date" to "string" and save your file.

 

Now return to the portal and add a new custom connection by clicking the 'Import an OpenAPI file' and selecting the OpenAPI file that you modified.

 

Capture cc2.JPG

 

 

You should now be able to use this new custom connector in your app and with some luck, it'll fix your blank date problem!

 

In answer to your second question, this won't have any effect on your original data or your original data source.

 

Let me know if you need me to clarify any of this, particularly the part where you need to modify the type definition.

 

Hope that helps.

View solution in original post

18 REPLIES 18
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Date NOT Showing or WRONG Date Shown

How is the registration_date property defined in the custom connector Open API specification? If it's defined as a date property (type: string, format: date), then the wire format is incorrect, which is one reason why PowerApps wouldn't be able to understand it. According to the spec, date properties need to have the yyyy-mm-dd format, and in your case it has the dd-mm-yyyy format.

 

If this is the case, then there are a couple of things you can do:

- Remove the format property from the OpenAPI specification - in this case the field will be read in PowerApps as a string, and after that you can convert it to a date using the DateValue function (passing a parameter one of the locales where the format is dd-mm-yyyy, such as "es-ES").

- Update the API that is referenced by the custom API to return the date in the yyyy-mm-dd format.

View solution in original post

PK_Hong
Level 8

Re: Date NOT Showing or WRONG Date Shown

Hi @CarlosFigueira

 

Thanks for the quick response.

In fact, after discussion with my friend, he knows about this known issue.

Now, in Asia, we used to use "dd-mm-yyyy", the changes to "yyyy-mm-dd" will disrupt our Android/iOS apps data structure.

 

Prior to ask him to remove Format: Date, I wish to know if it will affect Android/iOS apps in data query.

 

Meantime, is that due to his problem or PowerApps problem?

He is writing with JS and everytime seems fine, until I use PowerApps to access his database for me to create another app.

 

Please advice another alternative if any.

 

TQ

Super User
Super User

Re: Date NOT Showing or WRONG Date Shown

Hi @PK_Hong

 

Just as a comment, I think this is something that you can test yourself if you prefer not to wait for @taufiksu.

In the Connections section of the portal, you can download the OpenAPI specification for your custom connector. You can then open this in notepad, change the registration_date format from date to string, and then use this to create a new custom connector, or to update the existing one.

Maybe this might save you some time.

PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Date NOT Showing or WRONG Date Shown

Technically, if his connector (custom API) advertises that the property is of type string, and format date, then the data should come in that format (which is yyyy-mm-dd) - so the problem is in the mismatch between the custom API specification and the API implementation. Some clients are more lenient when parsing the data (which may cause wrong values to be parsed), and some (like PowerApps) are more strict (it prefers to set the value to null / Blank than to risk having a wrong date).

 

As far as Android / iOS apps being affected if the format property of the OpenAPI specification is removed, that depends on how the apps are consuming that API. If they depend on that specification and somehow are parsing the data from the network in the dd-mm-yyyy format (which they shouldn't - the spec is pretty clear on the format), then they may have a problem. If they're interpreting the data from the network "as is", or parsing it without looking at the OpenAPI specification, then they should not have a problem.

 

Notice that you have have your own OpenAPI specification that points to that API - if you follow what @timl suggested you should be able to have your own custom connector that talks to his API.

 

Super User
Super User

Re: Date NOT Showing or WRONG Date Shown

Thanks for the great explaination on how this works @CarlosFigueira

 

 

PK_Hong
Level 8

Re: Date NOT Showing or WRONG Date Shown

@CarlosFigueira

Hi 

Thanks I shall post to @timlfor help as I do not wish to disturb my friend at the moment.

Thanks for evertyhing as i am not familiar with those connector.

 

TQ

PK_Hong
Level 8

Re: Date NOT Showing or WRONG Date Shown

Hi @timl

 

Thanks for your support.

I am not a programmer those I know a little about editing in Notepad for HTML, JS, CSS.

I am using Codebeautify / Notepad to open the 

http://io.nowdb.net/v2/select_all/token/52f866................. link from @taifiksu.

and I can view the sript.

(So, normally I just copy and in PowerApps, i just paste to save the connector).

 

As you suggest,

1. how can I edit from here or notepad?

2. If finally modified the format date to formata blank or string, can I still access the original data from the same link?

TQ in advance for the guidance.

 

Screenshot (276).png

 

Super User
Super User

Re: Date NOT Showing or WRONG Date Shown

Hi @PK_Hong

 

The file that you need to modify is a copy of your OpenAPI specification, rather than the data in the link.

 

The first step is to find your custom connector in the portal.

custconn1.JPG

 

Click the download icon (highlighted) and save the file onto your computer.

 

Open the downloaded file in your text editor of choice. Within the file, search for the definition of registration_type. It'll look something like this:

 

"properties": {
   "registration_type": {
       "type": "date",

Change the type from "date" to "string" and save your file.

 

Now return to the portal and add a new custom connection by clicking the 'Import an OpenAPI file' and selecting the OpenAPI file that you modified.

 

Capture cc2.JPG

 

 

You should now be able to use this new custom connector in your app and with some luck, it'll fix your blank date problem!

 

In answer to your second question, this won't have any effect on your original data or your original data source.

 

Let me know if you need me to clarify any of this, particularly the part where you need to modify the type definition.

 

Hope that helps.

View solution in original post

PK_Hong
Level 8

Re: Date NOT Showing or WRONG Date Shown

Hi @timl

 

I got what you means and started to change.

Once confirmed done, I will reply here as reference for everyone.

Hope it works...Thanks so much

Good night

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,680)