Páginas filhas
  • FWJoinFilial

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.

...

Sintaxe: FwJoinFilial(cAlias1, cAlias2) → string


Bloco de código
languageerl
themeMidnight
titleExemplo de uso - Embedded SQL
local cAlias as character
local cJoin as character

cAlias := GetNextAlias()
cJoin := "%" + FWJoinFilial("SRA", "SRC") + "%"
 
BEGINSQL ALIAS "QTEMP"
	SELECT 
		cAlias
    SELECT
        SRA.RA_FILIAL, 
        
		SRA.RA_MAT, 
		
        SRC.RC_PD,
		        SRC.RC_VALOR
	    FROM
		        %table:SRA% SRA
	    INNER JOIN  %table:SRC% SRC ON
		        SRA.RA_MAT = SRC.RC_MAT AND
		        %exp:cJoin%
	    WHERE
		        SRA.RA_MAT = '000001' AND
		        SRA.RA_FILIAL = 'E01U01F01'		
ENDSQL    
ENDSQL
Bloco de código
languageapplescript
themeMidnight
titleExemplo de uso - MPSysOpenQuery
local cAlias as character
local cJoin as character
local cQuery as character

cJoin := FWJoinFilial("SRA", "SRC")

cQuery := "SELECT "
cQuery += "     SRA.RA_FILIAL, "
cQuery += "     SRA.RA_MAT, "
cQuery += "     SRC.RC_PD, "
cQuery += "     SRC.RC_VALOR "
cQuery += " FROM "
cQuery += "     " + RetSqlName("SRA") + " SRA "
cQuery += " INNER JOIN " + RetSqlName("SRC") + " SRC ON "
cQuery += "     SRA.RA_MAT = SRC.RC_MAT AND "
cQuery += FWJoinFilial("SRA", "SRC")
cQuery += " WHERE "
cQuery += "     SRA.RA_MAT = '000001' AND "
cQuery += "     SRA.RA_FILIAL = 'E01U01F01' "

cAlias := MPSysOpenQuery(cQuery)