
sharkieSBS
Newbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2018
05:38 PM
Is Array Reverse() always <UNINITIALIZED>?
I'm passing an ISO 8601 formatted date string to a Function, and then manipulating it.
I can `Split()` it, and the split creates an Array, and I can use bracket notion on it as expected.
But my attempts to `Reverse()` the Array only manage in my getting an `<UNINITIALIZED>` response.
and the Console logs:
I can work around the issue, obviously, but I wondered if there was something I needed to do programmatically to get the correct response from my code?
I can `Split()` it, and the split creates an Array, and I can use bracket notion on it as expected.
But my attempts to `Reverse()` the Array only manage in my getting an `<UNINITIALIZED>` response.
Function getDate(timestamp as String) as Object
datestamp = timestamp.Split("T")[0]
dateArray = datestamp.Split("-")
yarrAetad = dateArray.Reverse()
? timestamp
? Type(timestamp)
? dateArray
? Type(dateArray)
? yarrAetad
' return dateArray
return true
end Function
and the Console logs:
2018-11-17T15:20:00Z
String
<Component: roArray> =
[
"17"
"11"
"2018"
]
roArray
<UNINITIALIZED>
I can work around the issue, obviously, but I wondered if there was something I needed to do programmatically to get the correct response from my code?
_______________________________________________________________________________
Craig Sharkie
Connected TV Lead, Engineering – EDS & OD
sbs.com.au
Craig Sharkie
Connected TV Lead, Engineering – EDS & OD
sbs.com.au
2 REPLIES 2
renojim
Community Streaming Expert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2018
06:03 PM
Re: Is Array Reverse() always <UNINITIALIZED>?
You're not using Reverse() correctly. Reverse() returns Void, so you're setting yarrAetad to nothing. Reverse() acts on the array itself, so if you want to keep the original and the reversed array, you'll have to copy the array entry by entry to a new array and then Reverse() the new array. If you're not interested in the original, just do this:
-JT
dateArray = datestamp.Split("-")
dateArray.Reverse()
?dateArray
-JT
Roku Community Streaming Expert
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.

sharkieSBS
Newbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2018
08:00 PM
Re: Is Array Reverse() always <UNINITIALIZED>?
If I had an up-vote, you'd get it JT.
Thanks!
Thanks!
_______________________________________________________________________________
Craig Sharkie
Connected TV Lead, Engineering – EDS & OD
sbs.com.au
Craig Sharkie
Connected TV Lead, Engineering – EDS & OD
sbs.com.au