Iterate through array on notification

@rigpapa,
i am collicting a series of datasets into an array (basically thermostat settings and weather settings) so that i can see why one floor of the house is hot on certain days. the data collection works pretty well, but i was hoping i could email the data to myself decoding the array. for example, right now the data comes to me as

["07-23-2020,10:52:00,73.00,74.50,84.79,10.29","07-23-2020,10:52:36,73.00,74.50,84.79,10.29","07-23-2020,11:10:00,73.00,74.50,84.79,10.29","07-23-2020,11:20:00,73.00,74.50,84.79,10.29","07-23-2020,11:30:00,73.00,74.50,84.79,10.29","07-23-2020,11:40:00,73.00,74.50,84.79,10.29","07-23-2020,11:46:54,73.00,74.50,88.27,13.77","07-23-2020,11:56:47,73.00,75.00,88.27,13.27","07-23-2020,12:10:00,73.00,75.00,88.27,13.27","07-23-2020,12:13:47,73.00,75.50,88.27,12.77","07-23-2020,12:30:00,73.00,75.50,88.27,12.77","07-23-2020,12:40:00,73.00,75.50,88.27,12.77","07-23-2020,12:45:47,73.00,76.00,88.27,12.27","07-23-2020,13:00:00,73.00,76.00,88.27,12.27","07-23-2020,13:03:27,73.00,76.50,88.27,11.77","07-23-2020,13:20:00,73.00,76.50,88.27,11.77","07-23-2020,13:30:00,73.00,76.50,88.27,11.77","07-23-2020,13:40:00,73.00,76.50,88.27,11.77"]

but i was hoping i could format it pretty on email by adding some new lines to each array element. it seems that the iterate function either doesn’t work on the body of the email or (more likely) i don’t know how to use the iterate function to push the data. i was trying this on the body of the notification:

{ iterate( dataArray, i + "\n", "i" ) }

2 Likes

The iterate() function will still produce an array/table, and that doesn’t help you get to message text. What you are almost doing in your attempt (and good effort, by the way) is the core of the join() function. The join() function takes an array and a separator and makes a string of the array elements using the separator given in between them.

You should be able to do { join( dataArray, "\n" ) } for the email message string and get a result closer to what you are looking for, I think.

3 Likes

as always, @rigpapa to the rescue! had to do a bit of stringify and unstringify magic as the value was being fetched from another reactor, but that certainly did the trick. thank you!

1 Like

Best Home Automation shopping experience. Shop at getvera!

© 2020 Vera Control Ltd., All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules