How do I open a list of the "Queries SQL" category with VBA?

4

I want to invoke a VBA list of the " SQL Queries category". I know the PSO.Listas.GetF4SQL method but this way the list opens in "Modal" and does not allow to maximize the form. The goal is to use the PSO.AbreLista method, but I can not find the right category.

    
asked by anonymous 24.06.2018 / 23:09

3 answers

3

Assuming you want to open the clients category:

1 - Create a "Categories" module where you will declare all the constants related to your categories. In this case it will be

Public Const CAT_Clientes = "Clientes"

2 - Create another module that will be your file (which will be your audit module) with the name "Audit" where you will declare all the constants related to the "tabs" categories. In this case it will be:

Public Const MNU_TAB_CLIENTES As String = "mnuTabClientes"

3 - Next in your form associate the code following an action

PSO.AbreLista 1, CAT_Clientes, "Cliente", Me, <TextBox>, MNU_TAB_CLIENTES, blnModal:=True
    
25.06.2018 / 10:32
3

So you do not need to use base list ids because you're building your own list. Here's an example below.

Public Sub ListaContactos() 
    Dim strSql As StdBEStringBuilder

    'Usar sempre o string builder
    Set strSql = New StdBEStringBuilder

    strSql.Append ("SELECT C.Contacto, C.PrimeiroNome, C.UltimoNome,") 
    strSql.Append (" C.Email as CEmail, C.Telefone as CTelefone, C.Telemovel as CTelemovel,")
    strSql.Append (" L.TipoContacto, L.TipoEntidade, L.Entidade")
    strSql.Append (" FROM Contactos C INNER JOIN LinhasContactoEntidades L ON (C.ID = L.IDContacto)")
    strSql.Append (" WHERE ((L.Entidade = 'SOFRIO') AND (L.TipoEntidade = 'C')) ORDER BY L.Entidade")

    PSO.Listas.GetF4SQL "A minha Lista Contactos", strSql.Value, "Contacto,PrimeiroNome,UltimoNome,CEmail,Telefone,CTelemovel,TipoContacto,TipoEntidade,Entidade"
End Sub
    
25.06.2018 / 11:43
2

The AbreLista() method is not for what you want, because it works only as a category and associated Audit code. In a list without an associated category, you will not be able to access the same features as the SQL query-based lists. In this sense and as mentioned in the previous comments, you should use the GetF4SQL() method which, although working only in modal mode, allows access to those same functionalities of the normal lists, previously mentioned. So for now this scenario is set up like this, but later this will be rectified and implemented in version 10.

    
26.06.2018 / 13:13