Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I´m trying to load a table using a where clause that has a variable, but i got an error.
I have a field Period that is define with the 12 months. This field always have One value selected.
I created a variable vPeriod = Period. When I select the Period my variable vPeriod changes.
I have a table with 2 fields (Month and Amount), and I try to load the table with a where clause , trying to load data where Month>=vPeriod
I have this script but it doesnt work if I try to use the variable $(vPeriod) instead of a value (3 in the script)
Period:
LOAD * INLINE [
Period
1
2
3
4
5
6
7
8
9
10
11
12
];
Data_aux:
LOAD * INLINE [
Month, Value
1, 100
2, 200
3, 300
4, 400
5, 500
6, 600
7, 700
8, 800
9, 900
10, 1000
11, 1100
12, 1200
];
let vMonth = $(vPeriod);
//let vMonth = 3;
Data:
LOAD
Month,
Value as Amount
Resident Data_aux
Where Month >= $(vMonth);
Drop Table Data_aux;
I send you the qvw file.
Thank you very much for your help
Hello,
You could try adding a trigger on the Period field (Settings -> Document properties)

The button will appear as Add Action(s) when no actions have yet to be defined.

You shall find the modified qvw file in attachment,
Regards,
Philippe
Try putting single quotes around variable expansion like:
Where Month >= '$(vMonth)' ;
Hi tresesco,
It doesn´t work. It seems that the variable is null
Hello,
You could try adding a trigger on the Period field (Settings -> Document properties)

The button will appear as Add Action(s) when no actions have yet to be defined.

You shall find the modified qvw file in attachment,
Regards,
Philippe
see attachment
I simplified your script and user interface, hope is what you want
Data_aux:
LOAD * INLINE [
Month, Value
1, 100
2, 200
3, 300
4, 400
5, 500
6, 600
7, 700
8, 800
9, 900
10, 1000
11, 1100
12, 1200
];
Data:
LOAD Month,
Value as Amount
Resident Data_aux
Where Month >= $(vPeriod);
Drop Table Data_aux;
Find the attachment.
Hope this will help u..!
Thank you very much it works now