Versões comparadas

Chave

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

...

Nome

TipoObrigatórioDefaultDescrição

cField

CaracterX
Campo que será setado a consulta
aFieldsArrayX

Indica os campos da estrutura da consulta (chave-descrição).

Exemplo:

aFields[1]:"ED_CODIGO"

aFields[2]:"ED_DESCRIC"

cQueryCaracterX

Indica a tabela da SX5 que será utilizada para buscar a estrutura do lookup

lIsRequiredLógico
.F.Indica que é obrigatório o preenchimento do campo

...

Bloco de código
self:oSchema:setLookUpQuery(cField, aFields, cQuery, lIsRequired)

Sintaxe: self:oSchema:setLookUpQuery(<cField>, <aFields>, <cQuery>, <lIsRequired>) → nil

...

Bloco de código
titleExemplo 3 - padrão LookUp - Query
collapsetrue
#include "msobject.ch" 
#include "totvs.framework.treports.integratedprovider.th"

namespace custom.financeiro.naturezas.integratedprovider.lookup

@totvsFrameworkTReportsIntegratedProvider(active=.T.)
class SEDTReportsBusinessObject from totvs.framework.treports.integratedprovider.IntegratedProvider
    public method new() as object
    public method getDisplayName() as character
    public method getAreas() as array
    public method getData() as object
    public method getSchema() as object
endclass

method new() as object class SEDTReportsBusinessObject
_Super:new()
self:setDescription("Naturezas financeiras do Protheus")
self:setIsLookUp(.T.)
return self

method getDisplayName() as character class SEDTReportsBusinessObject
return "Naturezas"

method getAreas() as array class SEDTReportsBusinessObject
return {"Financeiro"}

method getData(nPage as numeric, oFilter as object) as object class SEDTReportsBusinessObject
self:oData:aliasToData("SED", oFilter)
return self:oData

method getSchema() as object class SEDTReportsBusinessObject
local cQuery as character
local aFields as array

self:oSchema:aliasToSchema("SED")

cQuery := "SELECT * FROM "+ RetSQLName("SED") +" WHERE D_E_L_E_T_ = ' '"
//cQuery := "SELECT ED_CODIGO, ED_DESCRIC FROM "+ RetSQLName("SED") +" WHERE D_E_L_E_T_ = ' '"
aFields := {"ED_CODIGO", "ED_DESCRIC"}
//Seta o lookup a partir da query
self:oSchema:setLookUpQuery("ED_CODIGO", aFields, cQuery, .F.)

return self:oSchema

...