PC SOFT
DEPOT EN LIGNE
POUR WINDEVWEBDEV ET WINDEV MOBILE

Exemplo WINDEV e WEBDEV de paginacao de dados em uma Table ou Looper
Publié par Boller
dans la catégorie Productivité
Nouveautés



Description
Exemplo de paginacao de dados em uma Table ou Looper


CODIGOS

// Summary: <specify the procedure action>
// Syntax:
//BuscaDados (<Filtro>)
//
// Parameters:
// Filtro:
// Example:
// <Specify a usage example>
//
PROCEDURE BuscaDados(Filtro)


TableDeleteAll(TABLEGRID_Clientes)

SqlCodigo is string = [
SELECT
t000_clientes.t000_cliente_id ,
t000_clientes.t000_nome ,
t000_clientes.t000_cpf
FROM
t000_clientes
WHERE
t000_clientes.t000_nome LIKE '%{filtro}%'
]

SqlCodigo = Replace(SqlCodigo, “{filtro}”,Filtro)

Dsquery01 is Data Source

IF HExecuteSQLQuery (Dsquery01, hQueryDefault, SqlCodigo ) = True

FOR EACH Dsquery01
TableAdd(TABLEGRID_Clientes, Dsquery01.t000_cliente_id +TAB+ Dsquery01.t000_nome +TAB+ Dsquery01.t000_cpf)
END

END

TableDisplay(TABLEGRID_Clientes, taInit)


//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

// Summary: <specify the procedure action>
// Syntax:
// CargaDadosRandom ()
//
// Parameters:
// None
// Return value:
// None
//
// Example:
// <Specify a usage example>
//
PROCEDURE CargaDadosRandom()

Info("inicio da carga")

// Initialize random number generator
InitRandom()

sRandomString is string

nRandomNumber is int

LOOP(10000)

// Generates the random string
LOOP (50)

// Generates a random number between 65-122 (A-z)
nCharacter is int = Random(65,122)
// Ignore characters between 91 and 96
WHILE (91 <= nCharacter <= 96)
nCharacter = Random(65,122)
END

// Fills the string
sRandomString += Charact(nCharacter)
END

sRandomString = Upper(sRandomString)
//------

// Initialize random number generator
InitRandom()

nRandomNumber = Random(11111111111, 99999999999)
//-------

t000_clientes.t000_nome = Middle(sRandomString,1,30) +TimeSys()
t000_clientes.t000_cpf = nRandomNumber

HAdd(t000_clientes)

END

Info("fim da carga")

//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

// Summary: <specify the procedure action>
// Syntax:
// PaginacaoAvancar ()
//
// Parameters:
// None
// Return value:
// None
//
// Example:
// <Specify a usage example>
//
PROCEDURE PaginacaoAvancar()

ID_Atual += QtdeLinhasTable()

TotalLinhas = QtdeLinhasTable()

TablePaginada(ID_Atual,TotalLinhas)

//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

// Summary: <specify the procedure action>
// Syntax:
//PaginacaoIncial ()
//
// Parameters:
// None
// Example:
// <Specify a usage example>
//
// Return value:
PROCEDURE PaginacaoIncial()

ID_Atual = 1

TotalLinhas = QtdeLinhasTable()

TablePaginada(ID_Atual,TotalLinhas)

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

// Summary: <specify the procedure action>
// Syntax:
// PaginacaoUltimo ()
//
// Parameters:
// None
// Return value:
// None
//
// Example:
// <Specify a usage example>
//
PROCEDURE PaginacaoUltimo()

ID_Atual = HNbRec(t000_clientes)-QtdeLinhasTable()

TotalLinhas = QtdeLinhasTable() + 1

TablePaginada(ID_Atual,TotalLinhas)

//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

// Summary: <specify the procedure action>
// Syntax:
// PaginacaoVoltar ()
//
// Parameters:
// None
// Return value:
// None
//
// Example:
// <Specify a usage example>
//
PROCEDURE PaginacaoVoltar()

ID_Atual -= QtdeLinhasTable()
IF ID_Atual < 0 THEN
ID_Atual = 1
END

TotalLinhas = QtdeLinhasTable()

TablePaginada(ID_Atual,TotalLinhas)

//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

// Summary: <specify the procedure action>
// Syntax:
// QtdeLinhasTable ()
//
// Parameters:
// None
// Return value:
// None
//
// Example:
// <Specify a usage example>
//
PROCEDURE QtdeLinhasTable()

TotalLinhas = IntegerPart(TABLEGRID_Clientes.Height / TABLEGRID_Clientes.LineHeight) - 1

RESULT TotalLinhas

//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

// Summary: <specify the procedure action>
// Syntax:
//TablePaginada (<ID_num>, <nTotalLinhas>)
//
// Parameters:
// ID_num:
// nTotalLinhas: <specify the role of nTotalLinhas>
// Example:
// <Specify a usage example>
//
PROCEDURE TablePaginada(ID_num,nTotalLinhas)

TableDeleteAll(TABLEGRID_Clientes)

SqlCodigo is string = [
SELECT
t000_clientes.t000_cliente_id ,
t000_clientes.t000_nome ,
t000_clientes.t000_cpf
FROM
t000_clientes
WHERE
t000_clientes.t000_cliente_id >= {id}
LIMIT {maximo}
]

SqlCodigo = Replace(SqlCodigo, “{id}”, ID_num)

SqlCodigo = Replace(SqlCodigo, “{maximo}”, nTotalLinhas)

Dsquery01 is Data Source

IF HExecuteSQLQuery (Dsquery01, hQueryDefault, SqlCodigo ) = True

FOR EACH Dsquery01
TableAdd(TABLEGRID_Clientes, Dsquery01.t000_cliente_id +TAB+ Dsquery01.t000_nome +TAB+ Dsquery01.t000_cpf)
END

END

TableDisplay(TABLEGRID_Clientes, taInit)

//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Illustrations, copies d'écran
none
none
Avis des utilisateurs
(Pour noter la ressource, cliquez sur Ecrire un avis)
Aucun avis ou commentaire ? Soyez le premier !
A PROPOS
EVALUATION :
00Aucune évaluation
TELECHARGEMENTS :
35
MISE À JOUR :
06 septembre 2023
VERSION :
28
CONCERNE :
WINDEV, WEBDEV, WINDEV Mobile
Version minimale : 28
TAILLE :
12,4 Mo