Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hy everybody,
I have a application where I need a botton that selects the last X minutes (in the example bellow I'll use 15 minutes).
I've tried something like that:
Variable =>
time1 = =date((LocalTime() - 0.010416), 'DD/MM/YYYY hh:mm:ss') ==> returns the last 15 minutes
Macro=>
sub last
set x= ActiveDocument.Fields("Opening_Date")
WHILE y = (Opening_Date >= time1)
x.toggleselect y
WEND
end sub
The macro says that is ok, but nothing is selected.
Any suggestions?
Thanks,
Leandra Scordamaglia
For version 9, try using Actions instead of a macro. In the button add action 'Select in Field'. Set the Field value to Opening_Date. For the search string use:
='>' & timestamp(now(1) - MakeTime(0,15,0))
Note I'm assuming "Opening_Date" is a real timestamp. You may have to adjust somewhat to make the select string format match your data format.
See attached qvw for working example.
-Rob
When this variable is created? If it´s in the script it should work, if not, you should use the EVALUATE function in the macro to calculate that expression´s result and use that in the selection command.
Fernando,
The variable is not in the script because if it was there it wouldn't represent the last 15 minutes, it would be the last 15 minutes from the last reload, right?
Could you give an example how to use the EVALUATE function?
Thanks,
Leandra, what version of QV?
-Rob
QV 9
For version 9, try using Actions instead of a macro. In the button add action 'Select in Field'. Set the Field value to Opening_Date. For the search string use:
='>' & timestamp(now(1) - MakeTime(0,15,0))
Note I'm assuming "Opening_Date" is a real timestamp. You may have to adjust somewhat to make the select string format match your data format.
See attached qvw for working example.
-Rob
Hey, Rob.
Thanks very much for your answer and suggestion.
We'll try it in my data model.
Once again, thanks.
Leandra Scordamaglia