In Workshop: How to create a button to display results in last 24 hours or given x time

I have create two variables as shown below
image

image

What do need to do so that I can create “Button” to only display data that are 24 hours before current time

Expected result
End-users can easily click the button to display only information from the past 24 hours.

Hello,
Once you have created that variable (let’s call it Last_24), I’d suggest you create another one (that has undefined as default value, let’s call it Last_24_Actual) and that you will use to actually filter your object set (so use it in the Object Set definition). At first, it should then not filter anything out (since it is undefined).

Then your button should be an Even > Set variable. And upon clicking, you copy the value from Last_24 to Last_24_Actual. thus, this should filter automatically your object set.

In addition, you should have a mechanism to reset the Last_24_Actual to undefined. To do that, you can have another button that is an Event > Reset > Last_24_Actual.

Hope this helps,
Max

Hi @maubert
thank you for the reply and solution.

But I don’t get it, and here is what I have tried so far
01 variable last_24 is numerical? as show below

02 variable last_24_actual, is also a numerical?

03: use last_24_actual variable as filter in Object Set definition:
How to add last_24_actual as filter in here

I would appreciate greatly it if you could, and have time to create a step-by-step guide here. It would help me get started with using more features Workshop.

Thx in advance

You are on the right track. But instead of creating a numerical, you create the date variable (exactly as you did in your initial message). And that’s the variable you need to use as a filter in your object set definition.
and Last_24_Actual should be of type Date too.

Note that in case the property you want to filter on (in your example it is Creation Time) is of Timestamp format, then you first need to cast (using Variable Transformation) the Last_24 variable into a Timestamp variable which is called Last_24_Timestamp. And as a consequence, Last_24_Actual should then be of Timestamp format too in that case.

So step-by-step:

  1. create a Date variable (using variable transformation) that current date minus 24 days
  2. [Only if your property is a timestamp] Convert the Date variable into a timestamp variable (using Cast in variable transformation)
  3. Create a Date variable (or Timestamp variable if property to filter is a Timestamp) with undefined by default
  4. Use that variable as a filter in your object set definition (Date Range After your parameter)
  5. Create a button with an Event : Set variable: You copy variable from step 1 (or 2) to variable created at step 3
  6. [Optional] Create a button to Reset the value of variable step 3 back to undefined to let users revert the filtering

Hi again
ref [quote=“maubert, post:4, topic:1001”]
create a Date variable (using variable transformation) that current date minus 24 days
[/quote]

I’am little confused, maybe should be 24 hours or given numerical value for hour as input?

Here is what I have tried, and I dont know if what I did this the first or first and second step combined.

Would you add print screens that are corresponding each steg please :slight_smile: :sweat_smile:

Sorry, indeed, it was current date minus 1 day (to do 24 hours).

And the warning you have is because you have selected first a Date variable.
If in the end you want a timestamp format, then you create a timestamp varialbe and do exactly what you did in the screenshot (except you replace 24 days by 24 hours or 1 day)

Thank you @maubert

Results about date


Used in Object Definition Set, and worked as expected :slight_smile:

Updated
Tried with function Button → Event, and did not work
Found out that Source variable and Target variable should be same type to work, but I still dont get the initial step if the first variable is a date type and is a datepicker…

Please provide a complete workflow with screenshots

Result about timestamp
Was not able to find “current time”, so I tried as shown below.

I dont know if I have done correct as you described, and why Workshop dont have the “current time”?