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

Validation variable in LOAD QLIKVIEW

Hello dear,

I need to load some fields based on variables, but if this variable does not exist as I can check it?

I explain:

The variable 'variable_$(anho)' is generated based on some external files, but may exist or not, but in the absence of load failure, so I need to validate if there is:

LOAD id_indicador,

     unidad,    

if(id_indicador=45 ,$(Variable_$(anho)),

if(id_indicador=46 ,$(Variable_$(anho)),

if(id_indicador=56 ,$(Variable_$(anho)),valorInd))) as valorInd,

     meta,

     id_objetivo,

     Año,

     periodo

FROM $(PathQVDInd)\Ind_indicadores.qvd(qvd);

i need pass of this:

if(id_indicador=45 ,$(Variable_$(anho))

to something like:

if(id_indicador=45 ,if(exist($(Variable_$(anho)),$(Variable_$(anho)),0)

I tried, but not work.

Please help me.

Regards!!

4 Replies
marcus_sommer

Try this:

LOAD

     id_indicador,

     unidad,    

     if(match(id_indicador, 45, 46, 56), if(len($(Variable_$(anho))) >= 1,

          $(Variable_$(anho)),valorInd) as valorInd,

     meta,

     id_objetivo,

     Año,

     periodo

FROM $(PathQVDInd)\Ind_indicadores.qvd(qvd);

where you might further need single-quotes around the variable if the content is a string like:

'$(Variable_$(anho))'

- Marcus

Not applicable
Author

Thanks guy, but not work 

For example, if was created the variable $(Variable_$(2017)) and $(Variable_$(2019)), but not the variable $(Variable_$(2018)), the sentence if(len($(Variable_$(2018))) >= 1 not work because the variable not exists, i need something like isset function of php, but applicable to Qlikview, it's possible?

marcus_sommer

And this one?

if(match(id_indicador, 45, 46, 56), if(len($(Variable_$(anho))&'Dummy') >= 6,

  $(Variable_$(anho)),valorInd) as valorInd

- Marcus

Not applicable
Author

The case is that the variables was creates previously, and in this LOAD i need to validate if was created or not, something like this in php : isset($(Variable_$(2018)).


I explain otherwise:

I need somethings like this (although exist not work for variable):

if(id_indicador=46 and exists($(QAlumnos_2018)),$(QAlumnos_2018),    ,

if(id_indicador=56 and exists($(QAlumnos_2019)),$(QAlumnos_2019),0))

I hope you can help me,

Thanks