Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Error in Expression :(

Hi I am checking the following condition in my expression.

vFromDate and vToDate are my two variables and I am checking the following condition :

  1. 1. if ELIG_EFF_DT between vFromDate and vToDate
  2. 2. ELIG_TERM_DT between vFromDate and vToDate

  1. 3. VFromDate between ELIG_EFF_DT and ELIG_TERM_DT
  2. 4. And vToDate between ELIG_EFF_DT and ELIG_TERM_DT

bug.jpg

The  1,2 conditions are wrkn properly but getting an error in 3,4.

Is the syntax correct??

Message was edited by: Poornima Narayanan Attached the QVW

12 Replies
Not applicable
Author

Can you please post the sample app

tresesco
MVP
MVP

Might be this is because you are using a variable in place of a field. One more thing; you can directly write like Field={">12<100"} to mean between; '*' would nto be required. Could you post a sample ?

Anonymous
Not applicable
Author

In 3 & 4 , you are getting error as you cannot pass variables , as only field is passed for the comparison.

Regards

Nitin

Not applicable
Author

hi

Replace $(vFromDate)  by   vFromDate.

similarly

Replace $(vToDate)  by   vToDate.

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

Instead of writing 3rd and 4th condition, use * in between the first 2 expressions. like the one below

If(ValueList('Male','Female','Unknown') = 'Male',

(COUNT({  <ELIG_GENDR_CD = {'M'},ELIG_EFF_DT = {">=$(=Date(vFromDate))<=$(=Date(vToDate))"} ,ELIG_AGE={'>=18'}>

  * <ELIG_GENDR_CD = {'M'},ELIG_TERM_DT = {">=$(=Date(vFromDate))<=$(=Date(vToDate))"} ,ELIG_AGE={'>=18'}>}

   DISTINCT ELIG_PERSON_KEY)))

tresesco
MVP
MVP

Try like:

  If(ValueList('Male','Female','Unknown') = 'Male',

(COUNT({  <ELIG_GENDR_CD = {'M'},ELIG_EFF_DT = {">=$(=Date(vFromDate))"}*{"<=$(=Date(vToDate))"} ,ELIG_AGE={'>=18'}>

  + <ELIG_GENDR_CD = {'M'},ELIG_TERM_DT = {">=$(=Date(vFromDate))"}*{"<=$(=Date(vToDate))"} ,ELIG_AGE={'>=18'}>

+ <ELIG_GENDR_CD = {'M'},ELIG_EFF_DT = {">=$(=Date($(vFromDate))) <=$(=Date($(vToDate)))"} ,ELIG_AGE={'>=18'}>

}

  DISTINCT ELIG_PERSON_KEY)))

PFA

Not applicable
Author

I want this condition to be checked


  1. 1. VFromDate between ELIG_EFF_DT and ELIG_TERM_DT
  2. 2. And vToDate between ELIG_EFF_DT and ELIG_TERM_DT
tresesco
MVP
MVP

I am afraid that what you are trying is both logically and technically inappropriate. Field values are usually compared against variable values and not the opposite way. You probably need to reconsider your logic.

Not applicable
Author

Does that solve all my four conditions

  1. if ELIG_EFF_DT between vFromDate and vToDate
  2. ELIG_TERM_DT between vFromDate and vToDate

3. VFromDate between ELIG_EFF_DT and ELIG_TERM_DT

4. And vToDate between ELIG_EFF_DT and ELIG_TERM_DT