Jump to content

Table to view daily samples for last 5 days


Recommended Posts

I have a step signal that represents the last sample taken. I would like to display a table that shows the last 5 days worth of samples - something like this:

  1-Aug 2-Aug 3-Aug 4-Aug 5-Aug
Sample 1 8 7 5 7 8
Sample 2 4 3 2 6 9
Sample 3 3 2   4 5
Sample 4    8     4
Sample 5         3


the signal doesn't contain sample numbers, but "sample 1" would be the first sample taken each day and then the number would increase until the next day begins. 


So far I've been able to create a table showing all sample values for one day like this using the formula $signal.toDiscrete.toCapsules


I'm not able to figure out how to give each capsule a sample number or how to display different days as different columns.


Link to comment
Share on other sites

  • Seeq Team

Hi Taylor,

Before we discuss the Table part, I would just like to point out that displaying similar result in a trend view is easier by utilizing our 'Capsule' view. KB article


In order to visualize in Table, there are more steps depending on how many samples you have in a day. 

Step 1: Create the daily condition.

Step 2: Create capsules for each sampling point


Step 3: From Step (2), extract the first to the nth capsule. Notice that I had also embedded all the samples value into the daily condition. Hopefully you are dealing with lab data or similar where you are not expecting too many sampling in a day.

//find each sampling point
$capsule1 = $daily.transform($w ->$all_sampling.toGroup($w).first())
$capsule2 = $daily.transform($w ->$all_sampling.toGroup($w).pick(2))
$capsule3 = $daily.transform($w ->$all_sampling.toGroup($w).pick(3))

//Embedded the value into daily condition and label Sample 1,2,3 accordingly.
.setproperty('Sample 1', $signal.aggregate(startValue(true), $capsule1, startKey(), 0s), startValue())
.setproperty('Sample 2', $signal.aggregate(startValue(true), $capsule2, startKey(), 0s), startValue())
.setproperty('Sample 3', $signal.aggregate(startValue(true), $capsule3, startKey(), 0s), startValue())


Step 4: Switch to the Table view and set accordingly as per below screenshot.




In case you did not able to view all the features I had used here, please check out the lower left corner of your Seeq browser window to see which version you have.



Edited by Sharlinda Salim
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...