cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JamesM
Helper V
Helper V

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
timl
Super User
Super User

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
timl
Super User
Super User

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

CarlosFigueira
Power Apps
Power Apps

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.

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,800)