Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

sreekanth_qlik
New Contributor III

GetFieldSelections within date range

Hi,

I have a filter 'WC_Claims', based on the option selected on filter I am displaying INDEMNITY, MEDICAL & GROSS_AMOUNT values using

GetFieldSelections within year range (start and end year taken into variables Eg. 2015 to 2016) correctly as below.

=If(GetFieldSelections(WC_Claims, '|') = 'Indemnity',

sum({<YEAR={'>=$(=vStartYear)<=$(=vEndYear)'}>}[INDEMNITY]),

If(GetFieldSelections(WC_Claims, '|') = 'Medical',

sum({<YEAR={'>=$(=vStartYear)<=$(=vEndYear)'}>} [MEDICAL]),

sum({<YEAR={'>=$(=vStartYear)<=$(=vEndYear)'}>} GROSS_AMOUNT))

When I am trying to simulate the same logic for Month range (From and To Accounting month taken from multi-box filters Eg. Mar-2015 to Mar-2016) using below approach. it is not working. Getting all month's values irrespective of From and To month range.

=If(GetFieldSelections(WC_Claims, '|') = 'Indemnity',

sum({<ACCOUNTING_MONTH={'>=$(=GetFieldSelections(From_Accounting_Month))<=$(=GetFieldSelections(To_Accounting_Month))'}>} [INDEMNITY]),

If(GetFieldSelections(WC_Claims, '|') = 'Medical',

sum({<ACCOUNTING_MONTH={'>=$(=GetFieldSelections(From_Accounting_Month))<=$(=GetFieldSelections(To_Accounting_Month))'}>} [MEDICAL]),

sum({<ACCOUNTING_MONTH={'>=$(=GetFieldSelections(From_Accounting_Month))<=$(=GetFieldSelections(To_Accounting_Month))'}>} GROSS_AMOUNT))

I am not sure what going wrong. Can someone pls help me. Thanks in Advance.

Note: If I directly use the below expression, it is working correctly

sum({<ACCOUNTING_MONTH={'>=$(=GetFieldSelections(From_Accounting_Month))<=$(=GetFieldSelections(To_Accounting_Month))'}>} GROSS_AMOUNT)

27 Replies

Re: GetFieldSelections within date range

Then, I am not sure the use of Pipe( | ) symbol this case, May be try this? I just remove the symbol in syntactically

=If(GetFieldSelections(WC_Claims) = 'Indemnity',

sum({<ACCOUNTING_MONTH={'>=$(=GetFieldSelections(From_Accounting_Month))<=$(=GetFieldSelections(To_Accounting_Month))'}>} [INDEMNITY]),

If(GetFieldSelections(WC_Claims) = 'Medical',

sum({<ACCOUNTING_MONTH={'>=$(=GetFieldSelections(From_Accounting_Month))<=$(=GetFieldSelections(To_Accounting_Month))'}>} [MEDICAL]),

sum({<ACCOUNTING_MONTH={'>=$(=GetFieldSelections(From_Accounting_Month))<=$(=GetFieldSelections(To_Accounting_Month))'}>} GROSS_AMOUNT))

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
sreekanth_qlik
New Contributor III

Re: GetFieldSelections within date range

Hi Anil,

Still the same result, Getting all values irrespective of From and To date range.

I need data within the date range, Is there any alternate way I can use?

Re: GetFieldSelections within date range

The above condition what i gave is If we selected from WC_Claims value called Indemnity, Then we have to show first condition. Just use this and please select Indemnity from WC_Claims. Whether it is working or not.


=If(GetFieldSelections(WC_Claims) = 'Indemnity',

sum({<ACCOUNTING_MONTH={'>=$(=GetFieldSelections(From_Accounting_Month))<=$(=GetFieldSelections(To_Accounting_Month))'}>} [INDEMNITY]))

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
sreekanth_qlik
New Contributor III

Re: GetFieldSelections within date range

Yes Anil, When I bring this condition(Indemnity alone and Full condition) in expression and enable the column, I'm seeing data for all month's, not just values within the range.

same happening upon Indemnity option selected.

Re: GetFieldSelections within date range

Would you able to provide the MOC for testing?

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
sreekanth_qlik
New Contributor III

Re: GetFieldSelections within date range

Security guidelines restrict me to upload file with sample data, I will prepare the data in-line and provide.

Re: GetFieldSelections within date range

try below

sum({<ACCOUNTING_MONTH={'>=$(=max(From_Accounting_Month))<=$(=max(To_Accounting_Month))'}>} [INDEMNITY])

sreekanth_qlik
New Contributor III

Re: GetFieldSelections within date range

Hi Kushal,

Still the same result, Getting all month's values upon enabling the column and Indemnity option selection

Re: GetFieldSelections within date range

what is the format of ACCOUNTING_MONTH,From_Accounting_Month and To_Accounting_Month are all these fields in proper format. Take all these fields in list box check they are right aligned. if so they are in proper format