Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Live chat with experts, bring your API Integration questions. June 15th, 10 AM ET. REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create table from 3 different QVDs

Friends, I need to create a QVD or a LOAD NFE_CTE create the table, based on information from 3 tables: NFE_EMIT, NFE_DEST and CTE:

-------------------------------------------------------------- Português ------------------------------------------------------------------

Amigos, estou precisando criar um QVD ou num LOAD criar a tabela NFE_CTE, baseado nas informações de 3 tabelas: NFE_EMIT, NFE_DEST e CTE, sendo:

------------------------------------------------------------------------------------------------------------------------------------------------

NFE_EMIT: (nfe_emit.qvd)

COD_INFNFECNPJ_CPF_EMIT
20130012399999999000254
201300124

88888888000199

20130012577777777000126
20130012666666666000210

NFE_DEST: (nfe_dest.qvd)

COD_INFNFECNPJ_CPF_DEST
20130012355555555000987
20130012444444444000135
20130012533333333000123
20130012622222222000158

CTE: (cte.qvd)

COD_DOC_FISCALCNPJ_REMCNPJ_CPF
3216549999999900025455555555000987
3216558888888800019944444444000135
3216567777777700012633333333000123
3216576666666600021022222222000158

The table below does not exist, create it would be ideal in qvw from QVDs above.

-------------------------------------------------------------- Português ------------------------------------------------------------------

A tabela abaixo não existe, o ideal seria cria-la no QVW a partir dos QVDs acima mencionados.

------------------------------------------------------------------------------------------------------------------------------------------------

NFE_CTE:

COD_INFNFECOD_DOC_FISCAL
201300123321654
201300124321655
201300125321656
201300126321657

How should I do?

I appreciate the help and sorry for the English.

-------------------------------------------------------------- Português ------------------------------------------------------------------

Qual seria o procedimento?

Agradeço antecipadamente qualquer ajuda e desculpe pelo inglês.

------------------------------------------------------------------------------------------------------------------------------------------------

Sávio Bueno.

1 Solution

Accepted Solutions
mov
Champion III
Champion III

Looks like NFE_EMIT.CNPJ_CPF_EMIT=CTE.CNPJ_REM, and NFE_DEST.CNPJ_CPF_DEST=CTE.CNPJ_CPF.  If this is correct:

Result:
LOAD DISTINCT
COD_INFNFE,
CNPJ_CPF_EMIT as CNPJ_REM
FROM nfe_emit.qvd (qvd);

JOIN (Result) LOAD DISTINCT
COD_INFNFE,
CNPJ_CPF_DEST as CNPJ_CPF
FROM nfe_dest.qvd (qvd);

JOIN (Result) LOAD DISTINCT
CNPJ_REM,
CNPJ_CPF,
COD_DOC_FISCAL
FROM cte.qvd (qvd);

You get table with four fields - COD_INFNFE, COD_DOC_FISCAL, CNPJ_REM, and CNPJ_CPF.
The last two are for joining.  Probably one is enough, you know better.  If you don't need these two fields, you can remove them at the end:
DROP FIELDS CNPJ_REM, CNPJ_CPF;

Regards,
Michael

View solution in original post

2 Replies
mov
Champion III
Champion III

Looks like NFE_EMIT.CNPJ_CPF_EMIT=CTE.CNPJ_REM, and NFE_DEST.CNPJ_CPF_DEST=CTE.CNPJ_CPF.  If this is correct:

Result:
LOAD DISTINCT
COD_INFNFE,
CNPJ_CPF_EMIT as CNPJ_REM
FROM nfe_emit.qvd (qvd);

JOIN (Result) LOAD DISTINCT
COD_INFNFE,
CNPJ_CPF_DEST as CNPJ_CPF
FROM nfe_dest.qvd (qvd);

JOIN (Result) LOAD DISTINCT
CNPJ_REM,
CNPJ_CPF,
COD_DOC_FISCAL
FROM cte.qvd (qvd);

You get table with four fields - COD_INFNFE, COD_DOC_FISCAL, CNPJ_REM, and CNPJ_CPF.
The last two are for joining.  Probably one is enough, you know better.  If you don't need these two fields, you can remove them at the end:
DROP FIELDS CNPJ_REM, CNPJ_CPF;

Regards,
Michael

View solution in original post

Not applicable
Author

Thank you Michael. It worked well.