Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi i have those two variables:
Set vAnnoTempo = GetFieldSelections(ANNOTEMPO);
Set vMeseTempo = GetFieldSelections(MESETEMPO);
ANNOTEMPO and MESETEMPO are fields of my TIME_TABLE
i want those variables takes from my fields selection:
When i choose for example Anno: 2017 Mese: 2
I want my chart will be filter from my vAnnoTempo and vMeseTempo, but its not start
The set analisys expression i have in my chart is:
=Sum({<ANNO_IN={"=$(vAnnoTempo)"},MESE_IN={"=$(vMeseTempo)"}>} CONSUMO_TOT_ANNUO)
ANNO_IN and MESE_IN are my fields in my CONTR table.
p.s.: CONTR table and TIME_TABLE are not connected, and this is correct, i not want are connected, i want do my filter with set analisys in this way, becouse for every dimension i have in my chart i need to do a different set analisys
Thanks
ok, i created a sample appli on my side
and it seems to work
but I see a problem in the definition of the variables you made in the post.
Verify the code below
TIME_TABLE:
load * inline [
ANNOTEMPO,MESETEMPO
2017,12
2018,1
2018,2
]
;
CONTR:
load * inline [
ANNO_IN,MESE_IN,CONSUMO_TOT_ANNUO
2017,12,201712
2018,1,201801
2018,2,201802
];
Set vAnnoTempo = GetFieldSelections(ANNO_IN);
Set vMeseTempo = GetFieldSelections(MESE_IN);
oups !!!!!!
sorry for the mistake
it's really
Set vAnnoTempo = GetFieldSelections(ANNOTEMPO);
Set vMeseTempo = GetFieldSelections(MESETEMPO);
and the result is :
very strange, it is as if the selection was inactive and it always shows the last month
hello
well, i don't know why it doesn't work with variables but the syntax below works
=Sum({<ANNO_IN={'$(=GetFieldSelections(ANNOTEMPO))'},MESE_IN={'$(=GetFieldSelections(MESETEMPO))'}>} CONSUMO_TOT_ANNUO)
Thanks, yes is really strange with variable not works..... i used your expression, but if a choose more months (1,2,3) it show me 0
if you want to select more then 1 value in a set analysis, you should code it this way
var={'v1','v2', ..... ,'vn'}
sto try something like
concat(getfield......,',') and maybe a quote somewhere
if i use:
=Sum({<ANNOIN={'$(=GetFieldSelections(ANNOTEMPO))'},MESEIN={'$(=CONCAT(GetFieldSelections(MESETEMPO)","))'},STATO_IN={'INGRESSO'}>} CONSUMO_TOT_ANNUO)
it not work
try with this concat
Concat(GetFieldSelections(Field name, chr(39) & ',' & chr(39)))
replace field name with the one desired
Yes, you are Super Oliver, it work..... but now i have another question:
i have to make an Aggregation for take only 1 row on the table for my field: COD_PUNTO, takinga the Max of my DATA_IN, but if i use in my set analisys this, it not work correctly:
DATA_IN={"=Aggr(Max(DATA_IN), COD_PUNTO)"}
so my all set analisys become like this:
=Sum({<DATA_IN={"=Aggr(Max(DATA_IN), COD_PUNTO)"},ANNOIN={'$(=GetFieldSelections(ANNOTEMPO))'},MESEIN={'$(=Concat(GetFieldSelections(MESETEMPO, chr(39) & ',' & chr(39))))'},STATO_IN={'INGRESSO'}>} CONSUMO_TOT_ANNUO)
where is the problem?
p.s.: i ask if you can post your .qvw you did for your example post before
enclose you aggr in $(=) as for the other functions