How to get 1 min, 5 min, 15 min table data using buttongroup?
Question
Application Type
Reactive

Hi Team,

I need to bifurcate the table data while display using the buttongroup tool, where user will have option to display the data which was accumulated within 1min and 5 min and so on. So, what logic should be applied to get the data which was accumulated in specific interval.

Hi Aditya, 

If I understand your question correctly what you want to do is filter the table that holds the data by creation date (or similar). You can use the values passed by the button group (on selecting them) and refresh the entity that is the source of your data. The variable that holds the value from the button should be in the filter. That should filter the correct values on the click of the button. 

Max

Hi Max, 

You got me correctly, but the variable i need to create will have one default value. so, i need to create 3 variable to store 3 values like, 1 for 1 min, 5 for 5 min and 15 for 15 mins. total 3 variables?

Hi @Aditya Chinchole 

For that use case, you can use a static entity and each record will map with a variable.

Regards

Gonçalo Almeida

Hi Aditya,

What will be the default value? Are you trying to filter on only 1 value (only under 5 mins) or within the range or over 1 min and under 5? Or even under 1 and under 5 mins? Cause that indeed changes the amount of variables needed but I am not sure if the button group will work in that case.

If you are only filtering 1 variable at a time below you still only need 1 local variable to assign to and then filter the table. Depending on which button you are clicking the value of the local variable will be set. 

A default value can also be set when rendering the screen or in a data action (if one is already executed).

I want to filter as, <1min, <5min and < 15 min. And buttongroup is same as this.


Try this: Add a button group with the three values. The variable should all be the same (I chose to name it Time).

Variable look like this:

Time and minutes are both integers. 

Set the OnChange of the button group to a new Client Action (ButtonGroup1OnChange) and add input parameter (Minutes; type Integer). 

In the OnChange action assign time to be minutes and refresh the data source. 

Your filter should like this (in case you have a DateTime field with a TimeStamp when the record was added to database): AddMinutes(YourTimeField Creation, Time) >= CurrDateTime() 

If you refresh data will be filtered again and correct records will appear.


I tried this logic of yours. But its not working for me. If my data source is PowercutSearchData.SearchTime

so I applied the filter as, 

AddMinutes(PowercutSearchData.SearchTime, Time)>= CurrDateTime()

Any idea why it is not working? Is there an error or is the filter just not working? 

Try to debug it and see which values are passed along and what happens to the data (you can try to add a number in the test values of the aggregate that fetches the data and see if data pops up)

Yes actually the filter is kindof not working. If i type time in test value, it just finds no record. can u share the oml of urs?

Solution
DateTimeFilterExamplev4.oml

Thanks for the oml, but I am missing CoreModule dependencies, so able to see how it works?

There is no other logic in Core then the creation of a record. It just Creates DateTimeExtensions records.  

The CreationTime = CurrDateTime().

Thanks Max, Its working now. actually It was my mistake. Now its working fine. But, what if we need to show some default data out there in the Table. Means as of now the data is getting accumulated according to the time. so, in case there is no data in <1 min, <5min and <15 min as well. Then How to show all the data gathered uptil now?

Hi Aditya, 

On the first rendering of the page you local var will be empty. Change the filter to 

If(Time <> 0,AddMinutes(DateTimeEntity.CreatingDate,Time) >= CurrDateTime(),1=1)

This will get all data if the Time variable is empty. 

To reset the filtering you can create a button or something that sets the value of Time to 0

Hi,

If you are using aggregate to keep record and want to filter data according to <1 ,<5 or <15min.

Use Filter as := extract time from date and time field and then filter data as <time in mins(variable).

For example:

Time(field)< time in mins(variable)

you can pass value of the time in mins(variable) on click action of button through assignment operator.


Hope this works.

Thanks

Can u show me this through images or oml?

Hi,

I have attached .oml please check.


datefilter.oml

Hi Samiksha. Thanks for oml. But I find some error while adding new employee. its not getting updated nor being displayed on the screen. So i am not able to view the actions of 5 min and so on

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.