Discussion board where members can learn more about Qlik Sense App Development and Usage.
good morning,I have a query, I have a table and I want it to show values of a field, but if this field is empty it shows the values of a field of another table, but it does not workWhat is it?
LOAD `ANTIC_ESTADO`,`ANTIC_NUMFAC`,if(`ANTIC_NUMOB_ORI`='', `DEFAC_NUMOOBL`, `ANTIC_NUMOB_ORI`) as `ANTIC_NUMOB_ORI`,`ANTIC_NUMOOBL`,`ANTIC_RUTPROV`,`ANTIC_TIPOB_ORI`,`ANTIC_TIPOFAC`,`ANTIC_TIPOOBL`,`ANTIC_ANO`,`ANTIC_AREAS`,`ANTIC_AUTORIZADO`,`ANTIC_PAGADO`,`ANTIC_RENDIDO`FROM [lib://mySQL Database Conection2/provi1/tbl_antic.qvd] (qvd) ;
Hi @Aleja54 ,
You could try using the "alt" function - which takes the first non-null value.
alt(ANTIC_ESTADO,ANTIC_NUMFAC) as ANTIC_NUMOB_ORI,
what happens is that my problem is not the null, but the field I want to show comes from another table
Hi,In this case you need first to join the field to the main table, and then using the "alt" function or any different approach that handle NULL.Example:Table 1:load
FROM [lib://mySQL Database Conection2/provi1/tbl_antic.qvd] (qvd) ;
FROM [lib://mySQL Database Conection2/provi1/table2.qvd] (qvd) ;
if(`ANTIC_NUMOB_ORI`='', `DEFAC_NUMOOBL`, `ANTIC_NUMOB_ORI`) as `ANTIC_NUMOB_ORI`
this doesn´t work
Sorry I didn't see your comment on the field being derived from a different table.
You could load a mapping table first that has the fields from the second table - and then use the alt function to evaluate if the field from the first table is empty:
so the evaulation becomes
alt(firstfield, ApplyMap('MappingTableName', <criteriafield>, <default_value>)), ...