<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Check if value exists in one table before selecting null value in another table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Check-if-value-exists-in-one-table-before-selecting-null-value/m-p/1811368#M1212656</link>
    <description>&lt;P&gt;Hello.&lt;BR /&gt;I'm trying to combine two tables with Union. I managed to do that, but I need to check if one value exists in table 1 (V_AuditoriaEventoServidor) before selecting the corresponding null value in table 2 (SHC_CapacitacaoNaoInstitucional). If value does not exists in table 1, then I want to select the null value in table 2. If value does exists in table 1, then I should not select null value in table 2.&lt;BR /&gt;&lt;BR /&gt;I'm combining the two tables using UNION.&lt;BR /&gt;&lt;BR /&gt;Where should I insert my IF? Should I declare a variable and set it to TRUE if value exists? How can I go on about doing this?&lt;BR /&gt;&lt;BR /&gt;Any help is appreciated.&lt;BR /&gt;Thank you in advance.&lt;BR /&gt;&lt;BR /&gt;Here's my script:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;//If Empregado.Curso exists in this table then null value from second table should not count&lt;BR /&gt;SQL SELECT NomeEmpregado as Servidor,&lt;BR /&gt;&amp;nbsp; evento."DataIniRealizacao" as Início,&lt;BR /&gt;&amp;nbsp; evento."DataFimRealizacao" as Fim,&lt;BR /&gt;&amp;nbsp; evento."CargaHoraria" as Horas,&lt;BR /&gt;&amp;nbsp; evento."descEvento" as Curso&lt;BR /&gt;FROM SARH.dbo.Empregado&lt;BR /&gt;LEFT JOIN SDTA.dbo."V_AuditoriaEventoServidor" as evento&lt;BR /&gt;ON evento.numCpf = Empregado.NumCpf&lt;BR /&gt;LEFT JOIN SARH.dbo.DadosFuncionais as dados&lt;BR /&gt;ON dados.CodEmpregado = Empregado.CodEmpregado&lt;BR /&gt;JOIN SARH.dbo.Orgao as orgao&lt;BR /&gt;ON orgao.CodOrgao = dados.CodUltimaLotacao&lt;BR /&gt;AND orgao.SiglaOrgao LIKE 'GR08%'&lt;BR /&gt;WHERE dados.DataSaidaEmpregado is null&lt;/P&gt;&lt;P&gt;UNION&lt;/P&gt;&lt;P&gt;SELECT NomeEmpregado as Servidor2,&lt;BR /&gt;&amp;nbsp; capacitacao."DataInicio" as Início2,&lt;BR /&gt;&amp;nbsp; capacitacao."DataFim" as Fim2,&lt;BR /&gt;&amp;nbsp; capacitacao."CargaHoraria" as Horas2,&lt;BR /&gt;&amp;nbsp; capacitacao."descTitulo" as Curso2&lt;BR /&gt;FROM SARH.dbo.Empregado&lt;BR /&gt;LEFT JOIN SDTA.dbo."SHC_CapacitacaoNaoInstitucional" as capacitacao&lt;BR /&gt;ON capacitacao.CodEmpregado = Empregado.CodEmpregado&lt;BR /&gt;LEFT JOIN SDTA.dbo."V_AuditoriaEventoServidor" as evento2&lt;BR /&gt;ON evento2.numCpf = Empregado.NumCpf&lt;BR /&gt;LEFT JOIN SARH.dbo.DadosFuncionais as dados&lt;BR /&gt;ON dados.CodEmpregado = Empregado.CodEmpregado&lt;BR /&gt;JOIN SARH.dbo.Orgao as orgao&lt;BR /&gt;ON orgao.CodOrgao = dados.CodUltimaLotacao&lt;BR /&gt;AND orgao.SiglaOrgao LIKE 'GR08%'&lt;BR /&gt;WHERE dados.DataSaidaEmpregado is null;&lt;/P&gt;</description>
    <pubDate>Fri, 28 May 2021 12:51:57 GMT</pubDate>
    <dc:creator>lailarhc</dc:creator>
    <dc:date>2021-05-28T12:51:57Z</dc:date>
    <item>
      <title>Check if value exists in one table before selecting null value in another table</title>
      <link>https://community.qlik.com/t5/QlikView/Check-if-value-exists-in-one-table-before-selecting-null-value/m-p/1811368#M1212656</link>
      <description>&lt;P&gt;Hello.&lt;BR /&gt;I'm trying to combine two tables with Union. I managed to do that, but I need to check if one value exists in table 1 (V_AuditoriaEventoServidor) before selecting the corresponding null value in table 2 (SHC_CapacitacaoNaoInstitucional). If value does not exists in table 1, then I want to select the null value in table 2. If value does exists in table 1, then I should not select null value in table 2.&lt;BR /&gt;&lt;BR /&gt;I'm combining the two tables using UNION.&lt;BR /&gt;&lt;BR /&gt;Where should I insert my IF? Should I declare a variable and set it to TRUE if value exists? How can I go on about doing this?&lt;BR /&gt;&lt;BR /&gt;Any help is appreciated.&lt;BR /&gt;Thank you in advance.&lt;BR /&gt;&lt;BR /&gt;Here's my script:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;//If Empregado.Curso exists in this table then null value from second table should not count&lt;BR /&gt;SQL SELECT NomeEmpregado as Servidor,&lt;BR /&gt;&amp;nbsp; evento."DataIniRealizacao" as Início,&lt;BR /&gt;&amp;nbsp; evento."DataFimRealizacao" as Fim,&lt;BR /&gt;&amp;nbsp; evento."CargaHoraria" as Horas,&lt;BR /&gt;&amp;nbsp; evento."descEvento" as Curso&lt;BR /&gt;FROM SARH.dbo.Empregado&lt;BR /&gt;LEFT JOIN SDTA.dbo."V_AuditoriaEventoServidor" as evento&lt;BR /&gt;ON evento.numCpf = Empregado.NumCpf&lt;BR /&gt;LEFT JOIN SARH.dbo.DadosFuncionais as dados&lt;BR /&gt;ON dados.CodEmpregado = Empregado.CodEmpregado&lt;BR /&gt;JOIN SARH.dbo.Orgao as orgao&lt;BR /&gt;ON orgao.CodOrgao = dados.CodUltimaLotacao&lt;BR /&gt;AND orgao.SiglaOrgao LIKE 'GR08%'&lt;BR /&gt;WHERE dados.DataSaidaEmpregado is null&lt;/P&gt;&lt;P&gt;UNION&lt;/P&gt;&lt;P&gt;SELECT NomeEmpregado as Servidor2,&lt;BR /&gt;&amp;nbsp; capacitacao."DataInicio" as Início2,&lt;BR /&gt;&amp;nbsp; capacitacao."DataFim" as Fim2,&lt;BR /&gt;&amp;nbsp; capacitacao."CargaHoraria" as Horas2,&lt;BR /&gt;&amp;nbsp; capacitacao."descTitulo" as Curso2&lt;BR /&gt;FROM SARH.dbo.Empregado&lt;BR /&gt;LEFT JOIN SDTA.dbo."SHC_CapacitacaoNaoInstitucional" as capacitacao&lt;BR /&gt;ON capacitacao.CodEmpregado = Empregado.CodEmpregado&lt;BR /&gt;LEFT JOIN SDTA.dbo."V_AuditoriaEventoServidor" as evento2&lt;BR /&gt;ON evento2.numCpf = Empregado.NumCpf&lt;BR /&gt;LEFT JOIN SARH.dbo.DadosFuncionais as dados&lt;BR /&gt;ON dados.CodEmpregado = Empregado.CodEmpregado&lt;BR /&gt;JOIN SARH.dbo.Orgao as orgao&lt;BR /&gt;ON orgao.CodOrgao = dados.CodUltimaLotacao&lt;BR /&gt;AND orgao.SiglaOrgao LIKE 'GR08%'&lt;BR /&gt;WHERE dados.DataSaidaEmpregado is null;&lt;/P&gt;</description>
      <pubDate>Fri, 28 May 2021 12:51:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Check-if-value-exists-in-one-table-before-selecting-null-value/m-p/1811368#M1212656</guid>
      <dc:creator>lailarhc</dc:creator>
      <dc:date>2021-05-28T12:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: Check if value exists in one table before selecting null value in another table</title>
      <link>https://community.qlik.com/t5/QlikView/Check-if-value-exists-in-one-table-before-selecting-null-value/m-p/1813202#M1212771</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try function exists() function in where clause.&lt;/P&gt;&lt;P&gt;VK&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jun 2021 07:54:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Check-if-value-exists-in-one-table-before-selecting-null-value/m-p/1813202#M1212771</guid>
      <dc:creator>Vikash</dc:creator>
      <dc:date>2021-06-06T07:54:12Z</dc:date>
    </item>
    <item>
      <title>Re: Check if value exists in one table before selecting null value in another table</title>
      <link>https://community.qlik.com/t5/QlikView/Check-if-value-exists-in-one-table-before-selecting-null-value/m-p/1813377#M1212776</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/142749"&gt;@Vikash&lt;/a&gt;&amp;nbsp;. Could you show me how, exactly?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jun 2021 12:00:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Check-if-value-exists-in-one-table-before-selecting-null-value/m-p/1813377#M1212776</guid>
      <dc:creator>lailarhc</dc:creator>
      <dc:date>2021-06-07T12:00:25Z</dc:date>
    </item>
  </channel>
</rss>

