PC SOFT
ONLINE REPOSITORY
FOR WINDEVWEBDEV AND WINDEV MOBILE

Home |  | Sign in | English US
Exemplo de como popular dados em Looper, Table com dados de arquivos, Query, Arrays, Programados e Struturas
Published by Boller
in the category Tools
New features



Description
Exemplo de como popular dados em Looper, Table com dados de arquivos, Query, Arrays, Programados e Struturas


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

LooperDeleteAll(LOOP_T001_clientes)

x is int

FOR EACH t001_clientes

LooperAdd(LOOP_T001_clientes)

x++

LOOP_T001_clientes[x].STC_id_valr = t001_clientes.t001_cliente_id
LOOP_T001_clientes[x].STC_nome_vlr = t001_clientes.t001_nome
LOOP_T001_clientes[x].STC_nasc_vlr = t001_clientes.t001_nascimento
LOOP_T001_clientes[x].t001_foto = t001_clientes.t001_foto

END

LooperDisplay(LOOP_T001_clientes,taInit)


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

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

FOR EACH t001_clientes

LooperAddLine(LOOP_T001_clientes,
t001_clientes.t001_cliente_id,
t001_clientes.t001_nome,
t001_clientes.t001_nascimento,
t001_clientes.t001_foto)

END

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

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

PROCEDURE MyWindow()

m_t001_clientes is Structure
m_t001_cliente_id est un 8-byte int
m_t001_nome est une ANSI string
m_t001_nascimento est une Date
m_t001_foto est un Buffer
END

mx_t001_clientes is array of m_t001_clientes //IMPORTANTE TEM QUE SER ARRAY

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

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

x is int=0

FOR EACH t001_clientes
x++
Add(mx_t001_clientes)
mx_t001_clientes[x].m_t001_cliente_id = t001_clientes.t001_cliente_id
mx_t001_clientes[x].m_t001_nome = t001_clientes.t001_nome
mx_t001_clientes[x].m_t001_nascimento = t001_clientes.t001_nascimento
mx_t001_clientes[x].m_t001_foto = t001_clientes.t001_foto
END

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

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

x is int

total is int = mx_t001_clientes.Count()

LOOP(total)
x++
LooperAddLine(LOOP_T001_clientes,
mx_t001_clientes[x].m_t001_cliente_id,
mx_t001_clientes[x].m_t001_nome,
mx_t001_clientes[x].m_t001_nascimento,
mx_t001_clientes[x].m_t001_foto)
END

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

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

TableDeleteAll(TABLE_T001_clientes)

x is int

FOR EACH t001_clientes

TableAdd(TABLE_T001_clientes)

x++

TABLE_T001_clientes[x].COL_T001_cliente_id = t001_clientes.t001_cliente_id
TABLE_T001_clientes[x].COL_T001_nome = t001_clientes.t001_nome
TABLE_T001_clientes[x].COL_T001_nascimento = t001_clientes.t001_nascimento
TABLE_T001_clientes[x].COL_T001_foto = t001_clientes.t001_foto

END

TableDisplay(TABLE_T001_clientes,taInit)

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

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

FOR EACH t001_clientes

TableAddLine(TABLE_T001_clientes,
t001_clientes.t001_foto,
t001_clientes.t001_cliente_id,
t001_clientes.t001_nome,
t001_clientes.t001_nascimento)

END

TableDisplay(TABLE_T001_clientes,taInit)

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

Illustrations, screen shots
none
none
User reviews
(To evaluate this resource, click 'Write a review')
Boller
PROCEDURE B_Detalhe()

e is int = 0

LOOP (100)
e++
arrItemDC[e,1] = ""
arrItemDC[e,2] = ""
END

sURL is string =
[
http://@IPSERVER@/ws_uisa_mob/ws_wms_descarga.php
]

sURL = Replace(sURL,"@IPSERVER@",INIRead("CONFIGURACOES","ip_server","",fCurrentDir()+"\config.ini"))

HTTPRequest(sURL)

sRetorno is JSON

IF StringCount(HTTPGetResult(httpHeader),"200") > 0 THEN
sRetorno = HTTPGetResult()

ToastDisplay("Atualizando informações ...")

nos is int = sRetorno..Count

IF nos > 0 THEN

e = 0

LOOP (nos)

e ++

arrItemDC[e,1] = sRetorno[e].placa
arrItemDC[e,2] = sRetorno[e].lote
END

Pos is int = 1
Contador is int = 0

LOOP_ItensDC.DeleteAll()

LOOP
IF Length(arrItemDC[Pos,1]) = 0 THEN
BREAK
END

LooperAdd(LOOP_ItensDC)
Contador = LooperCount(LOOP_ItensDC)

LOOP_ItensDC[Contador].STC_Placa = arrItemDC[Pos,1]
LOOP_ItensDC[Contador].STC_Lote = arrItemDC[Pos,2]
LOOP_ItensDC[Contador].STC_LoteDesc = "Lote : "

Pos ++
IF Pos > 100 THEN
BREAK
END

END

ELSE
ToastDisplay("Descargas não encontradas !")
END
ELSE
ToastDisplay("Erro de Comunicação com o Servidor !")
END

By Charlie / Colômbia
Boller
minhaurl is string=EDT_url
nPosicao is int=LooperAddLine(LOOP_NoName1)
sMeuhtml is string=[
<iframe src="[%minhaurl%]" width="300" height="300" allowfullscreen></iframe>
]
LOOP_NoName1[nPosicao].HTM_NoName1=sMeuhtml

By Paulo Viana
Boller
IF registros.tipo_anexo = "1" THEN
//LOOP_Tipos_problemas[n_index].SC_NoName1.MM_NoName1 = registros.Midia
n_index = LooperAddLine(LOOP_Tipos_problemas,s_cor, registros.ID, registros.Descricao, registros.thumbnail)
ELSE
n_index = LooperAddLine(LOOP_Tipos_problemas,s_cor, registros.ID, registros.Descricao, registros.Midia)
END

By Rogério Knappmann
Boller
Outro exemplo com imagem:

bufImagem is Buffer

dSaveImageJPEG(IMG_resultado, fCurrentDir() + fSep() + "Image.JPEG")

bufImagem = fLoadBuffer(fCurrentDir() + fSep() + "Image.JPEG")

ImagemB64 is Variant = Encode(bufImagem, encodeBASE64)

enviar_foto_recortada(id_pessoa,ImagemB64)

Close()
Boller
Outro exemplo:

PROCEDURE atualizar_lista_pessoas()

sNomePessoa is string = EDT_pesquisar

QRY_SELECAO_PESSOAS_BIO.params_nome_cliente = sNomePessoa

IF HExecuteQuery(QRY_SELECAO_PESSOAS_BIO) = True THEN

IF QRY_SELECAO_PESSOAS_BIO.pes_id_externo > 0 THEN

<COMPILE IF Configuration="iOS application">

LAYOUT_pessoas.Visible = True
LAYOUT_pessoas[3].Visible = False
IWC_admob.Visible = False

<END>

<COMPILE IF Configuration="Android application">

LOOP_pessoas.Visible = True
LAYOUT_404.Visible = False

IF gbAdmob_banner = False _OR_ gbAdmob_banner = ""

//nao faz nada

ELSE

LOOP_pessoas[3].Visible = True
IWC_admob.Visible = True

END
<END>

LooperDeleteAll(LOOP_pessoas)

FOR EACH QRY_SELECAO_PESSOAS_BIO

LooperAddLine(LOOP_pessoas,+...
QRY_SELECAO_PESSOAS_BIO.pes_id,+...
QRY_SELECAO_PESSOAS_BIO.pes_nome,+...
QRY_SELECAO_PESSOAS_BIO.pes_foto,+...
QRY_SELECAO_PESSOAS_BIO.pes_cpf,+...
QRY_SELECAO_PESSOAS_BIO.tp_pessoa,+...
QRY_SELECAO_PESSOAS_BIO.pes_status)

END

IF LOOP_pessoas = -1 THEN

LooperDeleteAll(LOOP_pessoas)
LAYOUT_pessoas.Visible = True
LAYOUT_404.Visible = True
LAYOUT_404.X = IMG_fundo_looper.X
LAYOUT_404.Y = IMG_fundo_looper.Y

ELSE

LAYOUT_pessoas.Visible = True
LAYOUT_404.Visible = False

END

ELSE

LooperDeleteAll(LOOP_pessoas)
LOOP_pessoas.Visible = True
LAYOUT_404.Visible = True
// EDT_pesquisar.Visible = False
// BTN_filtrar.Visible = False
// IMG_procurar.Visible = False
LAYOUT_404.X = IMG_fundo_looper.X
LAYOUT_404.Y = IMG_fundo_looper.Y

<COMPILE IF Configuration="Android application">

IF gbAdmob_banner = False _OR_ gbAdmob_banner = ""

//nao faz nada

ELSE

LAYOUT_pessoas[3].Visible = True
IWC_admob.Visible = True

END

<END>

END

END
Boller
Exemplo:

QueryProdutos.valorInicial = vini
QueryProdutos.valorFinal = vfim

If Hexecutequery(QueryProdutos) = true

For each QueryProdutos
Looperaddline(looperx, QueryProdutos.y)

End

End