Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set the DEMO

Hi All,

Can anyone please explain me the below code

SET DEMO_UE = if(getSelectedCount(GEN_DESC,true())> 0

or (GETOBJECTFIELD(0) = 'GEN_DESC') 

or (GETOBJECTFIELD(1) = 'GEN_DESC')

or (GETOBJECTFIELD(2) = 'GEN_DESC')

or (GETOBJECTFIELD(3) = 'GEN_DESC')

or (GETOBJECTFIELD(4) = 'GEN_DESC')

or (GETOBJECTFIELD(5) = 'GEN_DESC')

or (GETOBJECTFIELD(6) = 'GEN_DESC')

,

SUM(distinct GEN_UE),1)

// End of gender

*

if(

getselectedcount(AGE_DESC,true())> 0

or (GETOBJECTFIELD(0) = 'AGE_DESC') 

or (GETOBJECTFIELD(1) = 'AGE_DESC')

or (GETOBJECTFIELD(2) = 'AGE_DESC')

or (GETOBJECTFIELD(3) = 'AGE_DESC')

or (GETOBJECTFIELD(4) = 'AGE_DESC')

or (GETOBJECTFIELD(5) = 'AGE_DESC')

or (GETOBJECTFIELD(6) = 'AGE_DESC')

,

SUM( distinct AGE_UE)

//SUM(1)

,

1)

//End of age group

*

if(getSelectedCount(MARITAL_DESC,true())> 0

or (GETOBJECTFIELD(0) = 'MARITAL_DESC') 

or (GETOBJECTFIELD(1) = 'MARITAL_DESC')

or (GETOBJECTFIELD(2) = 'MARITAL_DESC')

or (GETOBJECTFIELD(3) = 'MARITAL_DESC')

or (GETOBJECTFIELD(4) = 'MARITAL_DESC')

or (GETOBJECTFIELD(5) = 'MARITAL_DESC')

or (GETOBJECTFIELD(6) = 'MARITAL_DESC')

,

SUM(distinct 

MARITAL_UE

),1)

//End of marital group

*

if(getselectedcount(RACE_DESC,true()) > 0

or (GETOBJECTFIELD(0) = 'RACE_DESC') 

or (GETOBJECTFIELD(1) = 'RACE_DESC')

or (GETOBJECTFIELD(2) = 'RACE_DESC')

or (GETOBJECTFIELD(3) = 'RACE_DESC')

or (GETOBJECTFIELD(4) = 'RACE_DESC')

or (GETOBJECTFIELD(5) = 'RACE_DESC')

or (GETOBJECTFIELD(6) = 'RACE_DESC')

,

SUM(distinct 

RACE_UE

),

1)

//End of race

*

if(getSelectedCount(HISPANIC_DESC,true())> 0

or (GETOBJECTFIELD(0) = 'HISPANIC_DESC') 

or (GETOBJECTFIELD(1) = 'HISPANIC_DESC')

or (GETOBJECTFIELD(2) = 'HISPANIC_DESC')

or (GETOBJECTFIELD(3) = 'HISPANIC_DESC')

or (GETOBJECTFIELD(4) = 'HISPANIC_DESC')

or (GETOBJECTFIELD(5) = 'HISPANIC_DESC')

or (GETOBJECTFIELD(6) = 'HISPANIC_DESC')

,

SUM(distinct

HISPANIC_UE

),1)

//End of hispanic

*

if(getSelectedCount(INCOME_DESC,true())> 0

or (GETOBJECTFIELD(0) = 'INCOME_DESC') 

or (GETOBJECTFIELD(1) = 'INCOME_DESC')

or (GETOBJECTFIELD(2) = 'INCOME_DESC')

or (GETOBJECTFIELD(3) = 'INCOME_DESC')

or (GETOBJECTFIELD(4) = 'INCOME_DESC')

or (GETOBJECTFIELD(5) = 'INCOME_DESC')

or (GETOBJECTFIELD(6) = 'INCOME_DESC')

,

SUM(distinct

INCOME_UE

),1)

//End of income

;

1 Solution

Accepted Solutions
swuehl
MVP
MVP

It seems to be code that has been placed in the script to define a variable (SET is a script statement to define a variable, just by setting text to the variable, without executing the part after the first equal sign).

This variable is called DEMO_UE.

You should see this variable in variable overview in QV desktop after running the script.

The code in variable will - as far as I see - not be executed on every state change, but needs to be expanded in an expression using dollar sign expansion, something like

=$(DEMO_UE)

The code will check for selections in some fields using GetSelectedCount(), then calculates the product of some Sums depending on the conditions.

GetObjectField ([index])

returns the name of the dimension. Index is an optional integer denoting which of the used dimensions that should be returned.

Example:

getobjectfield(2)

If you want to get more explanations about the details of the calculation, I think you need to look into the context / requirements of the application or ask the developer of that code.

View solution in original post

2 Replies
swuehl
MVP
MVP

It seems to be code that has been placed in the script to define a variable (SET is a script statement to define a variable, just by setting text to the variable, without executing the part after the first equal sign).

This variable is called DEMO_UE.

You should see this variable in variable overview in QV desktop after running the script.

The code in variable will - as far as I see - not be executed on every state change, but needs to be expanded in an expression using dollar sign expansion, something like

=$(DEMO_UE)

The code will check for selections in some fields using GetSelectedCount(), then calculates the product of some Sums depending on the conditions.

GetObjectField ([index])

returns the name of the dimension. Index is an optional integer denoting which of the used dimensions that should be returned.

Example:

getobjectfield(2)

If you want to get more explanations about the details of the calculation, I think you need to look into the context / requirements of the application or ask the developer of that code.

Not applicable
Author

Hi Swuehl,

Thanks for the reply, can you please help me in writing the sql for this logic.

Can you help me with the equivalent sql code for this