sexta-feira, 14 de agosto de 2020

DICAS 3021 - WINDEV TUTORIAL 44 - Pesquisa Multicriterio - Criacao Consulta - Parte B



https://youtu.be/umzSz1zrA5g

Bom Dia/Boa Tarde/Boa Noite

Esse Ao Vivo vai estrear as 11:00 do dia 26/08/2020 

DICAS 3021 - WINDEV TUTORIAL 44 - Pesquisa Multicriterio - Criacao Consulta - Parte B
Tutoriel WINDEV : Leçon 4.4.b. Recherche multicritère - Création de la requête

ASSUNTOS

EXPLICANDO COMO FUNCIONA QUERY
FAZENDO UMA QUERY PEDIDOS CONSULTA 


Video original da Franca

https://youtu.be/97ZY-02xI6E


Playlist Windev TUTORIAL

=================================

SELECT 
Orders_pedido.OrdersID AS OrdersID,
Orders_pedido.Date AS DATE,
Orders_pedido.Status AS Status,
Orders_pedido.TotalBT AS TotalBT,
Customer_cliente.FullName AS FullName,
PaymentMode_tipo_pagamento.Caption AS Caption
FROM 
Customer_cliente,
Orders_pedido,
PaymentMode_tipo_pagamento
WHERE 
PaymentMode_tipo_pagamento.PaymentModeID = Orders_pedido.PaymentModeID
AND Customer_cliente.CustomerID = Orders_pedido.CustomerID

ORDER BY 
DATE ASC











Creating the query used to find orders

Creating the query

  • The query editor will be used to create the query.
    1. Click Creating an element among the quick access buttons. The element creation window appears: click "Query­". The query creation wizard starts.
    2. Select the "Select" option.
      Indeed, this query will be used to select records. Go to the next step.
    3. The query description window is displayed. To build the query, we are going to select the elements that will be displayed in the result.
    4. Double-click the items in the analysis, to the left of the description window. The items taken into account are displayed in the middle of the screen.
      Remark: To display the items of different data files, simply click the arrow Arrow in front of the data file name.
      We want to display:
      • information regarding the order. Expand the "Orders" data file (click the arrow Arrow ) and double-click the items: OrdersID, Date, Status and TotalBT.
      • information regarding the customer who placed the order. Expand the "Customer" data file (click the arrow Arrow ) and double-click the "FullName" item.
      • information regarding the order payment method. Expand the "PaymentMode" data file (click the arrow Arrow ) and double-click the "Caption" item.
      The description window of the query is as follows:
      Query description
    5. The data will be sorted by date.
      • In the list of query elements, select the "Orders.Date" item, then click the "Sort" button and select "Sort on the selected item".
      • In the window that appears, indicate an ascending sort on the item.
        Adding a sort
      • Validate.
    6. A blue arrow with the number 01 appears on the right of "Orders.Date" item. This arrow indicates that an ascending order has been applied on this item. The number "01" indicates that this sort will be applied first.
      Sort in the query description window
    7. Give a name to the query: type "QRY_FindOrders" instead of "QRY_NoName1" in the "Query name" area:
      Query name
    8. Validate the query description window ("OK" button).
    9. The save window is displayed. Validate the proposed information.
    10. The graphic query representation is displayed:
      Graphic representation

Query test

Like all elements found in a WINDEV project, you have the ability to run the test of query that was just created:
  1. Click Test an element.
  2. The result is displayed in a window:
    Query result
    The result lists ALL orders.
    In our case, we want to display the orders corresponding to the search criteria only. To do so, we must use a query with parameters.

    Remark

    A popup menu is displayed when a right click is performed on the query result. You have the ability to export the result to:
    • an XLSX file (Excel).
    • a Word or OpenOffice file.
    • an XML file (eXtensible Markup Language).
    • an HFSQL file.
  3. Close the window.





DICAS 2978 - WINDEV TUTORIAL 1 - 1.1B - WINDEV TEMA ESCURO E IDIOMA DO AMBIENTE
DICAS 2979 - WINDEV TUTORIAL 2 - 1.2- CRIAR JANELA E INSERIR TEXTO E EXIBIR
DICAS 2980 - WINDEV TUTORIAL 3 - 2.1- VARIAVEIS PARTE 1
DICAS 2981 - WINDEV TUTORIAL 4 - 2.2- VARIAVEIS ESCOPO - PARTE 2
DICAS 2982 - WINDEV TUTORIAL 5 - 2.1- VARIAVEIS OPERADORES PARTE 3
DICAS 2983 - WINDEV TUTORIAL 6 - 2.1.D - VARIAVEIS STRINGS PARTE 4
DICAS 2984 - WINDEV TUTORIAL 7 - 2.1.E - VARIAVEIS ARRAYS PARTE 5
DICAS 2985 - WINDEV TUTORIAL 8 - 2.2.A - CONDICOES IF-SWITCH PARTE 1
DICAS 2986 - WINDEV TUTORIAL 9 - 2.2.B - CONDICOES PARTE 2
DICAS 2987 - WINDEV TUTORIAL 10 - 2.3.A - LOOP PARTE 1
DICAS 2988 - WINDEV TUTORIAL 11 - 2.3.B - LOOP EXEMPLOS PARTE 2
DICAS 2989 - WINDEV TUTORIAL 12 - Lesson 2.4. The procedures - PARTE 1
DICAS 2990 - WINDEV TUTORIAL 13 - Leçon 2.4.b. Procedures Parametros - PARTE 2
DICAS 2991 - WINDEV TUTORIAL 14 - PROCEDURES REFERENCIA - PARTE 3
DICAS 2992 - WINDEV TUTORIAL 15 - PROCEDURES OPCIONAIS OU OBRIGATORIAS - PARTE 4
DICAS 2993 - WINDEV TUTORIAL 16 - PROCEDURES EXEMPLOS - PARTE 5
DICAS 2994 - WINDEV TUTORIAL 17 - PERGUNTAS E RESPOSTA - PARTE 1
DICAS 2995 - WINDEV TUTORIAL 18 - PERGUNTAS E RESPOSTA - PARTE 2
DICAS 2996 - WINDEV TUTORIAL 19 - WINDEV E OS BANCOS DE DADOS
DICAS 2997 - WINDEV TUTORIAL 20 - PROJETO E ANALISE - CRIACAO
DICAS 2998 - WINDEV TUTORIAL 21 - PROJETO E ANALISE - ARQUIVOS DADOS CLIENTE - PARTE 2
DICAS 2999 - WINDEV TUTORIAL 22 - PROJETO E ANALISE - ARQUIVOS DADOS CRIACAO ARQUIVO PEDIDO - PARTE 3
DICAS 3000 - WINDEV TUTORIAL 23 - PROJETO E ANALISE - IMPORTANDO CVS-ARQUIVO TEXTO - PARTE 4
DICAS 3001 - WINDEV TUTORIAL 24 - PROJETO E ANALISE - IMPORTANDO ARQUIVO PRODUTO - PARTE 5
DICAS 3002 - WINDEV TUTORIAL 25 - PROJETO E ANALISE - LINK - PARTE 6
DICAS 3003 - WINDEV TUTORIAL 26 - RAD COMPLETO
DICAS 3004 - WINDEV TUTORIAL 27 - VISAO GERAL
DICAS 3005 - WINDEV TUTORIAL 28 - Adicionar e Modificar Janelas PRODUTOS - PARTE A
DICAS 3006 - WINDEV TUTORIAL 29 - Adicionar e Modificar Janelas PRODUTOS Formulario - PARTE B
DICAS 3007 - WINDEV TUTORIAL 30 - Adicionar e Modificar Janelas PRODUTOS ALINHAR CAMPOS - PARTE C









DICAS 3020 - WINDEV TUTORIAL 43 - Pesquisa Multicriterio - Apresentacao - Parte A



https://youtu.be/gDE0bGmuKtQ


Bom Dia/Boa Tarde/Boa Noite

Esse Ao Vivo vai estrear as 09:00 do dia 26/08/2020 

DICAS 3020 - WINDEV TUTORIAL 43 - Pesquisa Multicriterio - Apresentacao - Parte A
Tutoriel WINDEV : Leçon 4.4.a. Recherche multicritère - Présentation

ASSUNTOS

EXPLICANDO COMO FICARA ESSA PESQUISA


Video original da Franca

https://youtu.be/-tRpfIqudJo


Playlist Windev TUTORIAL





Lesson 4.4. Multicriteria search
This lesson will teach you the following concepts
  • Creating a query with parameters.
  • Creating the interface used to select the search criteria.
  • Passing parameters to a query.
  • Displaying the query result in a Table control.
Lesson duration

Estimated time: 40 mn
Previous LessonTable of contentsNext Lesson
Overview
In the previous lesson, we have explained how to perform a search on a single criterion (the customer name). In this lesson, we will give the user the ability to perform a multicriteria search.
In our example, this search will be done on the "Orders" data file. The user will be able to select:
  • the order status,
  • the payment method,
  • the order dates taken into account.
The interface of "WIN_Menu" window is as follows:
Interface of WIN_Menu
This interface includes:
  • controls used to select the search criteria.
  • Button controls used to start the search or print the result.
  • a Table control used to display the search result. This Table control is based on a query. This query will be used to select the records to display. The Table control will list the search result.
The first step consists in creating the query used to select the records.

Remark

What is a select query?
A select query is a query that will "choose" the records corresponding to the specified criteria.
This type of query is called a select query because the SELECT command is used in SQL language.

Answer

A corrected project is available. This project contains the different windows created in this lesson. To open the corrected project, in WINDEV's home page (Ctrl + <), click "Tutorial" and select "Full application (With windows)".










DICAS 2978 - WINDEV TUTORIAL 1 - 1.1B - WINDEV TEMA ESCURO E IDIOMA DO AMBIENTE
DICAS 2979 - WINDEV TUTORIAL 2 - 1.2- CRIAR JANELA E INSERIR TEXTO E EXIBIR
DICAS 2980 - WINDEV TUTORIAL 3 - 2.1- VARIAVEIS PARTE 1
DICAS 2981 - WINDEV TUTORIAL 4 - 2.2- VARIAVEIS ESCOPO - PARTE 2
DICAS 2982 - WINDEV TUTORIAL 5 - 2.1- VARIAVEIS OPERADORES PARTE 3
DICAS 2983 - WINDEV TUTORIAL 6 - 2.1.D - VARIAVEIS STRINGS PARTE 4
DICAS 2984 - WINDEV TUTORIAL 7 - 2.1.E - VARIAVEIS ARRAYS PARTE 5
DICAS 2985 - WINDEV TUTORIAL 8 - 2.2.A - CONDICOES IF-SWITCH PARTE 1
DICAS 2986 - WINDEV TUTORIAL 9 - 2.2.B - CONDICOES PARTE 2
DICAS 2987 - WINDEV TUTORIAL 10 - 2.3.A - LOOP PARTE 1
DICAS 2988 - WINDEV TUTORIAL 11 - 2.3.B - LOOP EXEMPLOS PARTE 2
DICAS 2989 - WINDEV TUTORIAL 12 - Lesson 2.4. The procedures - PARTE 1
DICAS 2990 - WINDEV TUTORIAL 13 - Leçon 2.4.b. Procedures Parametros - PARTE 2
DICAS 2991 - WINDEV TUTORIAL 14 - PROCEDURES REFERENCIA - PARTE 3
DICAS 2992 - WINDEV TUTORIAL 15 - PROCEDURES OPCIONAIS OU OBRIGATORIAS - PARTE 4
DICAS 2993 - WINDEV TUTORIAL 16 - PROCEDURES EXEMPLOS - PARTE 5
DICAS 2994 - WINDEV TUTORIAL 17 - PERGUNTAS E RESPOSTA - PARTE 1
DICAS 2995 - WINDEV TUTORIAL 18 - PERGUNTAS E RESPOSTA - PARTE 2
DICAS 2996 - WINDEV TUTORIAL 19 - WINDEV E OS BANCOS DE DADOS
DICAS 2997 - WINDEV TUTORIAL 20 - PROJETO E ANALISE - CRIACAO
DICAS 2998 - WINDEV TUTORIAL 21 - PROJETO E ANALISE - ARQUIVOS DADOS CLIENTE - PARTE 2
DICAS 2999 - WINDEV TUTORIAL 22 - PROJETO E ANALISE - ARQUIVOS DADOS CRIACAO ARQUIVO PEDIDO - PARTE 3
DICAS 3000 - WINDEV TUTORIAL 23 - PROJETO E ANALISE - IMPORTANDO CVS-ARQUIVO TEXTO - PARTE 4
DICAS 3001 - WINDEV TUTORIAL 24 - PROJETO E ANALISE - IMPORTANDO ARQUIVO PRODUTO - PARTE 5
DICAS 3002 - WINDEV TUTORIAL 25 - PROJETO E ANALISE - LINK - PARTE 6
DICAS 3003 - WINDEV TUTORIAL 26 - RAD COMPLETO
DICAS 3004 - WINDEV TUTORIAL 27 - VISAO GERAL
DICAS 3005 - WINDEV TUTORIAL 28 - Adicionar e Modificar Janelas PRODUTOS - PARTE A
DICAS 3006 - WINDEV TUTORIAL 29 - Adicionar e Modificar Janelas PRODUTOS Formulario - PARTE B
DICAS 3007 - WINDEV TUTORIAL 30 - Adicionar e Modificar Janelas PRODUTOS ALINHAR CAMPOS - PARTE C








DICAS 3019 - WINDEV TUTORIAL 42 - Pesquisa Simples - Navegacao pelos Arquivos - PARTE F



https://youtu.be/vvc0-KmjV-4


Bom Dia/Boa Tarde/Boa Noite

Esse Ao Vivo vai estrear as 19:00 do dia 25/08/2020 

DICAS 3019 - WINDEV TUTORIAL 42 - Pesquisa Simples - Navegacao pelos Arquivos - PARTE F
Tutoriel WINDEV : Leçon 4.3.f. Recherche simple - Parcours des fiches


ASSUNTOS

EXPLICANDO O QUE SERA FEITO
CRIANDO BOTAO PRIMEIRO
ACERTANDO LARGURA IGUAL A ALTURA 
COMANDOS UTILIZADOS
FAZENDO O CODIGO DO PRIMEIRO CLIENTE
   HReadFirst
   HOut
   FileToScreen
FAZENDO O CODIGO DO CLIENTE ANTERIOR
   HReadLast
   HReadPrevious
FAZENDO O CODIGO DO PROXIMO CLIENTE
   HReadFirst
   HReadNext
FAZENDO O ULTIMO CLIENTE   
   HReadLast
   

Video original da Franca

https://youtu.be/y4OfwgxgdcI


Playlist Windev TUTORIAL

// btn_pesquisa_identica
// Encontra o cliente a partir de seu identificador
HReadSeekFirst(Customer_cliente,CustomerID,COMBO_cliente)
IF HFound(Customer_cliente) THEN
// mostrar os dados
FileToScreen()
END
===============================
// BTN PESQUISA GENERICA
// Finds a customer from his name
// Encontra um cliente a partir de seu nome
HReadSeek(Customer_cliente,FullName,EDT_Nome_Procure)
IF HFound(Customer_cliente) THEN
// mostre os dados
FileToScreen()
ELSE
Error("nao encontrado")
END
===============================
// BTN_PRIMEIRO
// Le o primeiro Cliente // Reads the first customer
HReadFirst(Customer_cliente)
IF HOut(Customer_cliente) = True THEN
Info("NAO TEM DADOS")
ELSE
FileToScreen()
END
===============================
// BTN_ANTERIOR 
// If no search is in progress
// Se nenhuma pesquisa estiver em andamento
IF HOut(Customer_cliente) THEN
HReadLast(Customer_cliente) // le o ultimo cliente
END
HReadPrevious(Customer_cliente) // le o cliente anterior
IF HOut(Customer_cliente)=True THEN 
Info("inicio do arquivo de dados alcancado")
ELSE
FileToScreen() // vamos mostrar os dados nos edt
END
===============================

//BTN_PROXIMO
// If no search is in progress
// Se nenhuma pesquisa estiver em andamento
IF HOut(Customer_cliente) THEN
    HReadFirst(Customer_cliente) // Lê o primeiro cliente
END
HReadNext(Customer_cliente) // Le o próximo cliente
// Se o final do arquivo de dados for alcançado
IF HOut(Customer_cliente)=True THEN
Info("FIM DO ARQUIVO ALCANCADO")
ELSE
FileToScreen() //MOSTRA OS DADOS
END
===============================
// BTN_FINAL
// Reads the last customer
// LER O CLIENTE FINAL
HReadLast(Customer_cliente)
IF HOut(Customer_cliente)=True THEN
Info("NAO ENCONTRADO CLIENTE")
ELSE
FileToScreen()
END










Browsing forms

We are now going to add four Button controls to browse the different records of the "Customer" data file. These controls are in a "recorder" layout.
Recorder buttons
These controls will allow you to:
  • browse through the different records in the data file,
  • browse through all the records corresponding to a generic search.
They include an icon and they are used to display:
  • the first record,
  • the previous record,
  • the next record,
  • the last record.
  • To create the Button control used to display the first file record:
    1. If necessary, display the "Finding customers" Tab control pane in the editor.
    2. On the "Creation" pane, in the "Usual controls" group, click Create a Button control.
    3. The shape of the control appears under the mouse pointer. Then click the Tab control pane, below "Generic search". The Button control is automatically created.
  • A skin template will be used to standardize the interface of project windows. This skin template defines the style for all controls found in the windows. A specific style is defined for each recorder Button control. To apply this style:
    1. Select the Button control if necessary.
    2. Display the popup menu (right mouse click) and select "Choose a style".
    3. All styles defined for the buttons are displayed in the window.
      Control style
      Select "BTN_First".
    4. Validate.
  • Modify the name of the Button control:
    1. Open the control description window:
      • Select the Button control.
      • Display the popup menu (right mouse click) and select "Description".
    2. This control is named "BTN_First".
    3. Validate the description window.
  • We are now going to type the WLanguage code associated with this control:
    1. Right-click the control. Select "Code" from the menu that is displayed.
    2. In the code window that appears, write the following WLanguage code in the "Click" event:
      // Reads the first customer
      HReadFirst(Customer)
      IF HOut(Customer) = True THEN
      // No customer
      Info("No form to view.")
      ELSE
      // Displays the customer data
      FileToScreen()
      END
      HReadFirst is used to read the first file record according to the key used for the last search (FullName in our case).
  • Likewise, create 3 Button controls.
    • The names of these controls are: "BTN_Previous", "BTN_Next" and "BTN_Last".
    • These controls are respectively associated with the styles: "BTN_Previous", "BTN_Next" and "BTN_Last".
    • The WLanguage code corresponding to the "Click" event of "BTN_Previous" is:
      // If no search is in progress
      IF HOut(Customer) THEN
      // Reads the last customer
      HReadLast(Customer)
      END
       
      // Reads the previous customer
      HReadPrevious(Customer)
      // If the start of the data file is reached
      IF HOut(Customer) = True THEN
      Info ("Start of data file reached.")
      ELSE
      // Displays the customer data
      FileToScreen()
      END
    • The WLanguage code corresponding to the "Click" event of "BTN_Next" is:
      // If no search is in progress
      IF HOut(Customer) THEN
      // Reads the first customer
      HReadFirst(Customer)
      END
       
      // Reads the next customer
      HReadNext(Customer)
      // If the end of the data file is reached
      IF HOut(Customer) = True THEN
      Info("End of data file reached.")
      ELSE
      // Displays the customer data
      FileToScreen()
      END
    • The WLanguage code corresponding to the "Click" event of "BTN_Last" is:
      // Reads the last customer
      HReadLast(Customer)
      IF HOut(Customer) = True THEN
      // No customer
      Info("No form to view.")
      ELSE
      // Displays the customer data
      FileToScreen()
      END
    In these different codes:
    • HReadLast is used to read the last file record according to the key used for the last search.
    • HReadNext reads the record whose key value is immediately greater than the one of current record.
    • HReadPrevious reads the record whose key value is immediately less than the one of current record.
    In any case:
    • HOut is used to find out whether the data file is empty.
    • FileToScreen is used to display the record on the screen.

Remark

The code in the "Next" and "Previous" Button controls contains additional lines of code to:
  • Check whether a search was already performed in the Customer data file (test of HOut to find out whether the file reading has started).
  • Read the first or last record if necessary. Indeed, the next or previous record cannot be read if no reading was performed in the data file.
  • Save the window by clicking Save an element among the quick access buttons.

Window test

  • Let's run a window test:
    1. Run the window test ( Run the window test among the quick access buttons).
    2. Click the "Finding customers" tab pane if necessary.
    3. Find a customer (perform a generic search on "BEEF" for example).
    4. Browse the data file by clicking each one of the browse buttons.
    5. Stop the test to go back to the editor.



DICAS 2978 - WINDEV TUTORIAL 1 - 1.1B - WINDEV TEMA ESCURO E IDIOMA DO AMBIENTE
DICAS 2979 - WINDEV TUTORIAL 2 - 1.2- CRIAR JANELA E INSERIR TEXTO E EXIBIR
DICAS 2980 - WINDEV TUTORIAL 3 - 2.1- VARIAVEIS PARTE 1
DICAS 2981 - WINDEV TUTORIAL 4 - 2.2- VARIAVEIS ESCOPO - PARTE 2
DICAS 2982 - WINDEV TUTORIAL 5 - 2.1- VARIAVEIS OPERADORES PARTE 3
DICAS 2983 - WINDEV TUTORIAL 6 - 2.1.D - VARIAVEIS STRINGS PARTE 4
DICAS 2984 - WINDEV TUTORIAL 7 - 2.1.E - VARIAVEIS ARRAYS PARTE 5
DICAS 2985 - WINDEV TUTORIAL 8 - 2.2.A - CONDICOES IF-SWITCH PARTE 1
DICAS 2986 - WINDEV TUTORIAL 9 - 2.2.B - CONDICOES PARTE 2
DICAS 2987 - WINDEV TUTORIAL 10 - 2.3.A - LOOP PARTE 1
DICAS 2988 - WINDEV TUTORIAL 11 - 2.3.B - LOOP EXEMPLOS PARTE 2
DICAS 2989 - WINDEV TUTORIAL 12 - Lesson 2.4. The procedures - PARTE 1
DICAS 2990 - WINDEV TUTORIAL 13 - Leçon 2.4.b. Procedures Parametros - PARTE 2
DICAS 2991 - WINDEV TUTORIAL 14 - PROCEDURES REFERENCIA - PARTE 3
DICAS 2992 - WINDEV TUTORIAL 15 - PROCEDURES OPCIONAIS OU OBRIGATORIAS - PARTE 4
DICAS 2993 - WINDEV TUTORIAL 16 - PROCEDURES EXEMPLOS - PARTE 5
DICAS 2994 - WINDEV TUTORIAL 17 - PERGUNTAS E RESPOSTA - PARTE 1
DICAS 2995 - WINDEV TUTORIAL 18 - PERGUNTAS E RESPOSTA - PARTE 2
DICAS 2996 - WINDEV TUTORIAL 19 - WINDEV E OS BANCOS DE DADOS
DICAS 2997 - WINDEV TUTORIAL 20 - PROJETO E ANALISE - CRIACAO
DICAS 2998 - WINDEV TUTORIAL 21 - PROJETO E ANALISE - ARQUIVOS DADOS CLIENTE - PARTE 2
DICAS 2999 - WINDEV TUTORIAL 22 - PROJETO E ANALISE - ARQUIVOS DADOS CRIACAO ARQUIVO PEDIDO - PARTE 3
DICAS 3000 - WINDEV TUTORIAL 23 - PROJETO E ANALISE - IMPORTANDO CVS-ARQUIVO TEXTO - PARTE 4
DICAS 3001 - WINDEV TUTORIAL 24 - PROJETO E ANALISE - IMPORTANDO ARQUIVO PRODUTO - PARTE 5
DICAS 3002 - WINDEV TUTORIAL 25 - PROJETO E ANALISE - LINK - PARTE 6
DICAS 3003 - WINDEV TUTORIAL 26 - RAD COMPLETO
DICAS 3004 - WINDEV TUTORIAL 27 - VISAO GERAL
DICAS 3005 - WINDEV TUTORIAL 28 - Adicionar e Modificar Janelas PRODUTOS - PARTE A
DICAS 3006 - WINDEV TUTORIAL 29 - Adicionar e Modificar Janelas PRODUTOS Formulario - PARTE B
DICAS 3007 - WINDEV TUTORIAL 30 - Adicionar e Modificar Janelas PRODUTOS ALINHAR CAMPOS - PARTE C







Teste

Teste
teste