Saltar para o conteúdo
Consultoria · Automação · Dados · Digital

Arquivo do autor

PowerApps – Best Practices

PowerApps - Best Practices

PowerApps is a versatile platform for building custom business apps that can connect to various data sources and services. To ensure that your PowerApps projects are efficient, maintainable, and scalable, it’s important to follow best practices. Here are some PowerApps best practices to consider:

  1. Plan Your App: Before you start building your app, take the time to plan it out. Define the app’s purpose, requirements, and user needs. Create a design and data architecture plan to guide your development.

  2. Use App Templates: PowerApps provides pre-built templates for common app scenarios. Consider using these templates as a starting point to save time and ensure you follow best practices.

  3. Responsive Design: Design your app to be responsive so it works well on various screen sizes and devices. Use layout containers and flexible design elements.

  4. Separation of Concerns: Follow the Model-View-Controller (MVC) or Model-View-ViewModel (MVVM) pattern to separate your app’s data, user interface, and logic. This makes your app more maintainable and easier to test.

  5. Use Custom Connectors: If you need to connect to external services or data sources, consider creating custom connectors. Custom connectors offer better performance and can be reused across multiple apps.

  6. Optimize Data Loading: Avoid loading unnecessary data. Use filters, delegation, and data shaping functions like Sort and Filter to fetch only the data you need. Delegation ensures that data processing happens on the data source side rather than in PowerApps, which can improve performance.

  7. Error Handling: Implement robust error handling to provide a better user experience. Use the Error function to capture and display meaningful error messages to users.

  8. Testing and Debugging: Test your app thoroughly during development. Use the built-in debugging tools to identify and fix issues. Also, involve end-users in testing to gather feedback.

  9. Version Control: Use version control systems like GitHub to track changes to your app’s code. This helps in collaboration and rollback in case of issues.

  10. Documentation: Document your app’s design, data sources, and functionality. This documentation is valuable for future maintenance and for onboarding new team members.

  11. Security: Implement appropriate security measures. Use Azure Active Directory for authentication and authorization. Limit access to sensitive data and functionality based on user roles.

  12. Performance Optimization: Optimize your app for performance by minimizing the number of calls to external data sources and avoiding complex formulas when possible. Use collections to store and manipulate data locally.

  13. User Training: Provide training and support for app users. Make sure they understand how to use the app effectively.

  14. Monitor and Analyze: Use Power Platform’s built-in monitoring and analytics tools to track app usage, identify performance bottlenecks, and gather insights for improvements.

  15. Stay Informed: Stay updated with the latest PowerApps features, updates, and best practices by regularly checking Microsoft’s official documentation and community forums.

Remember that best practices can evolve over time as the PowerApps platform and your organization’s needs change. Regularly review and update your practices to ensure your apps remain efficient and effective.

 

 
 
clicopt
Create popup messagebox in powerapp

Create a Popup message box in Powerapp Canva

Create a popup message box

  1. Create a New Screen :
    • In your Power App, go to the “Screens” tab.
    • Click on “New Screen” and choose a blank screen template or any other layout that suits your design.
  2. Design the Popup :
    • On the new screen, design your popup box. You can use container and add labels, buttons, input controls, or any other elements you need for your popup’s content. 
  3. Create a Button or Trigger to Show the Popup :
    • On the screen (or wherever you want to trigger the popup), create a button or control (eg, an icon).
    • In the “OnSelect” property of the button, set it to navigate to the popup screen and make it visible:
        • Set(PopupVisible, true);
  4. Create a Close Button:
    • On the popup screen, create a close button (e.g., an “X” icon or a “Close” button).
    • In the “OnSelect” property of the close button, set it to navigate back to the previous screen and hide the popup:
        • Set(PopupVisible, false);
  5. Use a Variable for Visibility:
    • Create a variable to control the visibility of the popup. In the app’s OnStart or OnVisible property, initialize the variable:
        • Set(PopupVisible, false);
    • Set the “Visible” property of the popup screen to the value of the variable:
        • PopupVisible

                Test Your Popup:

    • Preview or publish your Power App and test the popup functionality.
clicopt

Avaliação de Desempenho em Excel

Avaliação de desempenho é uma ferramenta de RH que vai além da análise da performance individual e coletiva das pessoas colaboradoras e seus comportamentos.

clicopt
Excel

Tabela periódica Atalhos Excel

360085765_741849454613471_1290443440714800397_n Tabela periódica Atalhos Excel
clicopt
PowerApp Low Code - Collection Large Sharepoint Lists

Collecting large lists in PowerApps from SharePoint

Collecting large lists in PowerApps from SharePoint

// — Process Start —
// — Clear all collections —
Clear(colDummy);
Clear(colIterations);
Clear(colNumbersTable);
Clear(cCollection);  // — Collection where store all Sharepoint records

 

/*****************************************************************************************
Start generate records series
List up to 2 million records, if necessary increases the value of the records in the vectors
*******************************************************************************************************/
ClearCollect(
    colNumTemp,
    [
        1,
        2,
        3,
        4,
        5,
        6,
        7,
        8,
        9,
        10
    ]
);
ForAll(
    colNumTemp,
    ForAll(
        colNumTemp,
        ForAll(
            colNumTemp,
            Collect(
                colDummy,
                {dummy: 1}
            );
            Collect(
                colNumbersTable,
                {Number: CountRows(colDummy)}
            )
        )
    )
);
// — Series end
// — Get the first and last record of the list
UpdateContext(
    {
        FirstRecord: First(
            Sort(
                sharepointList, //— Sharepoint list to go find the records
                ID,
                Ascending
            )
        )
    }
);
UpdateContext(
    {
        LastRecord: First(
            Sort(
                sharepointList, //— Sharepoint list to go find the records
                ID,
                Descending
            )
        )
    }
);
// —The capture of records begins
UpdateContext(
    {
        Iterations: RoundUp(
            (LastRecord.ID – FirstRecord.ID) / 2000,
            0
        )
    }
);
// —Create a new collection to register the first ID found
ClearCollect(
    varCounter,
    {min_Num: FirstRecord.ID}
);
/*****************************************************************************************
A ForAll loop is used where the column number is less than or equal to the number of iterations
Updates the iteration collection with the current iteration number, minimum and maximum numbers
update the collection of counters
********************************************************************************************************/
ForAll(
    Filter(
        colNumbersTable,
        Number <= Iterations
    ),
    Collect(
        colIterations,
        {
            Number: Last(
                FirstN(
                    colNumbersTable,
                    CountRows(colIterations) + 1
                )
            ).Number,
            min_Num: First(varCounter).min_Num,
            max_Num: First(varCounter).min_Num + 1999
        }
    );
    Patch(
        varCounter,
        First(varCounter),
        {
            min_Num: Last(
                FirstN(
                    colIterations,
                    CountRows(colIterations) + 1
                )
            ).max_Num + 1
        }
    )
);
// End of capture of records
/*************************************************************************************
Finally, with a ForAll loop we will collect all our items
** !! Unable to use the ID column to make delegations !! **
** The ID here must be a numeric field (numID)**
****************************************************************************************************/
ForAll(
    colIterations,
    Collect(
        sharepointList, //— Sharepoint list to go find the records
        Filter(
            sharepointList, //— Sharepoint list to go find the records
            numID >= min_Num && numID <= max_Num
        )
    )
);
// Downloads collections
// — END —
clicopt

Desproteger Livro Excel

Protegeu a sua folha ou livro de excel e esqueceu-se da senha?
Tem um livro de excel que se encontra protegido e precisa ver as fórmulas mas não sabe a senha?
Então, neste artigo, poderemos ver com hackear um ficheiro excel de forma simples.
Lembre-se sempre: use o seu conhecimento para o bem! 😉 e com responsabilidade 👨‍⚖️

O Código funciona em versões de Excel anteriores a 2010, mas nada que não se consiga resolver .

Se o ficheiro protegido for de uma versão recente ou posterior a 2003, basta fazer-se o seguinte:

1° Guarde o seu ficheiro no formato 97-2003.

Clique no separador “Arquivo”, depois clique em “Salvar como” e selecione a opção “Pasta de trabalho do Excel 97-2003”

1 Desproteger Livro Excel

Depois do ficheiro guardado numa versão suportada,  segue-se o desbloqueio 🙃.

Para proceder ao desbloqueio, abrimos o ficheiro, carregamos nas teclas “Alt+F11” para abrir o VBE, o editor de códigos do Excel. De seguida, carregamos em “Inserir” e selecionamos “Módulo”.

2 Desproteger Livro Excel

Por fim, basta copiar o código abaixo e colar dentro do módulo que criamos:

Sub DesbloquearFolhaExcel()

On Error Resume Next

For i = 65 To 66

For j = 65 To 66

For k = 65 To 66

For l = 65 To 66

For m = 65 To 66

For i1 = 65 To 66

For i2 = 65 To 66

For i3 = 65 To 66

For i4 = 65 To 66

For i5 = 65 To 66

For i6 = 65 To 66

For n = 32 To 126

ActiveSheet.Unprotect Chr(i) & Chr(j) & Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)

If ActiveSheet.ProtectContents = False Then

MsgBox “Folha de Excel desprotegida com sucesso!”, vbInformation

Exit Sub

End If

Next

Next

Next

Next

Next

Next

Next

Next

Next

Next

Next

Next

End Sub

3 Desproteger Livro Excel
clicopt

O impacto da Impressão em Série Word (VBA)

O código a seguir, guarda em Word e em PDF documento a documentos de um ficheiro de impressão em série. 

Copie o código abaixo e cole em VBA no Microsoft Word, para abrir o Editor Visual Basic Applications:  (Alt+F11) ou lado direito do rato no separador(friso), personalizar separador e depois seleccionar Programador.

Sub Guardar_Imprimir_Individualmente()

‘Separa um registo de um ficheiro de impressão em série de cada vez para a pasta escolhida

Application.ScreenUpdating = False

Dim StrFolder As String, StrName As String, MainDoc As Document, i As Long

Set MainDoc = ActiveDocument

With MainDoc

  StrFolder = .Path & “”

  For i = 1 To .MailMerge.DataSource.RecordCount

    With .MailMerge

      .Destination = wdSendToNewDocument

      .SuppressBlankLines = True

      With .DataSource

        .FirstRecord = i

        .LastRecord = i

        .ActiveRecord = i

        StrName = .DataFields(“Partners”)

      End With

      .Execute Pause:=False

    End With

    With ActiveDocument

      .SaveAs2 FileName:=StrPath & StrName & “.docx”, FileFormat:=wdFormatXMLDocument, AddToRecentFiles:=False

      ‘ and/or:

      .SaveAs2 FileName:=StrPath & StrName & “.pdf”, FileFormat:=wdFormatPDF, AddToRecentFiles:=False

      .Close SaveChanges:=False

    End With

  Next i

End With

Application.ScreenUpdating = True

End Sub

clicopt

PowerApp Adicionar e Ler PDF

Incorporar documentos PDF no Powerapps

Para inserir um PDf na Aplicação Powerapp é necessario criar um fluxo.

O fluxo de automatização da Microsoft que permite tudo isto é tão simples como se segue:

Fluxo PowerAutomate:

Fluxopdf PowerApp Adicionar e Ler PDF
  1. É necessário criar um Fluxo instantâneo a partir do Powerapps. Comecei com um fluxo em branco e depois adicionei a ação “PowerApps – Trigger”
PDF1 PowerApp Adicionar e Ler PDF
1.É necessário criar um Flow que possa correr de forma instantanea a partir do PowerApps. Comecei com um Fluxo em branco e adicionei a ação “PowerApps – Trigger” para começar.

2. Sharepoint  – Get file content using path, aqui coloquei o caminho do ficheiro onde se encontra o PDF, depois de carregar onde diz “Ask in PowerApps”, temos o getfilecontent…

pdf2 PowerApp Adicionar e Ler PDF
pdf3 PowerApp Adicionar e Ler PDF

3. Resposta ao PowerApps, na verdade, só precisamos retornar as informações de arquivo corretas que o controle do Power Apps PDF Viewer entende.

Para que o valor do parâmetro do arquivo PDF retorne ao PowerApps, selecionamos Expression e onde aparece fx, colamos a seguinte expressão:

body(‘Get_file_content_using_path’)[‘$content’]

 

pdf4 PowerApp Adicionar e Ler PDF

Terminamos aqui o nosso fluxo.

No PowerApps:

Criar uma nova aplicação em PowerApps, depois disso já dentro do PowerApps, no Menu Action, vai a PowerAutomate e insere o Fluxo criado, basta carregar em cima e é inserido no PowerApps.

fluxopdf-1 PowerApp Adicionar e Ler PDF

Na aplicação, cria um formulário com o Botão que pretende abrir o PDF e outro formulário onde vai inserir o componente PDF Viewer (Experimental).

No primeiro formulário, onde tem o Botão que vai abrir o formulário seguinte, na propriedade On Select, o código é:

Navigate( ViewPDF, ScreenTransition.None, { { selecteditem_v: “name of your pdf without extension” } )

No formulário criado, onde tem o componente PDF Viewer (Experimental), na propriedade do formulário On Visible, vou criar uma variável que oculta o controlo do PDF Viewer enquanto o fluxo é executado para retornar o conteúdo do PDF. Quando o fluxo é concluído, defino a propriedade “loading_v” de volta para false, para que o PDF fique visível.

O código aqui é:

UpdateContext({ loading_v: true }); UpdateContext({ pdf_v: ‘name of your flow’.Run( Concatenate( First( Split( selecteditem_v.Name, “.” ) ).Result, “.pdf” ) ) }); UpdateContext({ loading_v: false })

No código acima, passo o nome do arquivo para o fluxo e crio e uso uma variável “pdf_v” que conterá o conteúdo do documento PDF retornado pelo fluxo.

O objetivo da função “Split” usada no código acima é remover a extensão do nome do arquivo original do nome do documento original e depois substituí-la por um nome de extensão do arquivo “.pdf”.

PDF PowerApp Adicionar e Ler PDF

Por fim, no controlo PDF Viewer, defino a propriedade “Document” como pdf_v.pdf e a propriedade Visible como !loading_v.

clicopt
Modelo Desporto

Template de Powerpoint – Desporto

clicopt
Modelo Powerpoint

Template de Powerpoint Natureza

clicopt
↑
Show Buttons
Hide Buttons