Hi Mic,
You can use a macro as a mapper. In this case, the macro expects as input a
subgts containing the sliding windows ticks.
You can use this macro:
<%
'gts' STORE
$gts SIZE 2 <
<% [ 0.0 ] %>
<%
$gts 0 ATINDEX 4 GET 'a' STORE
$gts 1 ATINDEX 4 GET 'b' STORE
[ $b $a - $a / 100.0 * ]
%>
IFTE
%>
'mapper' STORE
This macro returns 0.0% if it's the first tick, or the increasing percent
if the sliding window has 2 values.
Here's a link with your
example: https://snapshot.senx.io/0005a145839e2b66-0-0-1a3b631c6d0b8b11
Le vendredi 20 mars 2020 03:17:48 UTC+1, Skadomersmtl a écrit :
>
> Hi,
>
> I'm a new warpscript user and I would like to know if there is a mapper
> function to calculate the percent between two values of a list:
>
> For example I found the mapper.delta with a sliding window of 1 to find
> the delta between two values of the list, but I would like to have the
> increasing or decreasing percentage between each values
> [
> [
> NEWGTS "GTS1" RENAME
> 10 NaN NaN NaN 5.0 ADDVALUE
> 20 NaN NaN NaN 120.0 ADDVALUE
> 30 NaN NaN NaN 140.0 ADDVALUE
>
> NEWGTS "GTS2" RENAME
> 10 NaN NaN NaN 8.0 ADDVALUE
> 20 NaN NaN NaN 42.0 ADDVALUE
> ]
> mapper.delta
> 1
> 0
> 0
> ] MAP
>
> Thanks for your help and have a nice day
>
> Mic
>
--
You received this message because you are subscribed to the Google Groups "Warp
10 users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/warp10-users/4dbe9262-3437-4c48-8806-5fa3de81ca82%40googlegroups.com.