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

Datetime value returned from custom connector not able to be used in textbox?

I have a custom connector that returns the following: 

 

[
  {
    "LastHeardFrom": "2018-10-03T12:46:04.247"
  }
]

I pick this up in the visible property of my screen: 

 

Set(heartBeatDateTime,InSiteConnector.GetStoreHeartBeat({rowlimit:1,server:selectedServer,ordercol:"RowInsertDateTime",order:"DESC"}))

I then try to use the variable HeartBeatDateTime in my text property (with an IF statement) 

 

If(loadInSiteCheck,"",Text(heartBeatDateTime.LastHeardFrom))

 

But i get the error 'expected a text or numeric value'. I have tried wrapping it in Text() but no joy. Where am I going wrong? 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Datetime value returned from custom connector not able to be used in textbox?

Hi @JamesM

I'm not exactly sure what GetStoreHeartBeat returns so I'm just guessing. If it returns multiple records, could you try the following syntax?

If(loadInSiteCheck,"",Text(First(heartBeatDateTime).LastHeardFrom))

View solution in original post

3 REPLIES 3
Super User
Super User

Re: Datetime value returned from custom connector not able to be used in textbox?

Hi @JamesM

I'm not exactly sure what GetStoreHeartBeat returns so I'm just guessing. If it returns multiple records, could you try the following syntax?

If(loadInSiteCheck,"",Text(First(heartBeatDateTime).LastHeardFrom))

View solution in original post

Power Apps Staff CarlosFigueira
Power Apps Staff

Re: Datetime value returned from custom connector not able to be used in textbox?

In addition to what @timl mentioned (the custom API returns a table, so you need to specify one of the records to retrieve the 'LastHeardFrom' property, such as the First one), the format of the data that your API is returning is not a datetime value per the Open API specification (Data types section, which refers RFC 3339) - it's missing the time zone offset part ('Z' for UTC, or [+-]HH:MM for specific time zones), so PowerApps may not interpret it as a date/time value if it's defined in the Open API on the custom connector as such.

 

If you are having this problem, you have a couple of alternatives: either update the API to return the date/time value in the expected format, or update the custom connector specification to use string as the type of that property, and in PowerApps use the DateTimeValue function to convert that into a date/time value.

JamesM
Level 8

Re: Datetime value returned from custom connector not able to be used in textbox?

Thanks guys, this is solved. I needed to specify the record e.g. First(recordName).value as opposed to just recordName or value. 

Helpful resources

Announcements
thirdimage

New Badges

Check it out!

thirdimage

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

Top Solution Authors
Top Kudoed Authors
Users online (4,692)