DADOS

TENHO UM APLICATIVO ONDE O USUÁRIO COLETA INFORMAÇÕES DE DETERMINADOS EQUIPAMENTOS.

CADA EQUIPAMENTO TEM UM QR CODE, E QUANDO LIDO ESTE QR CODE ABRE UM FORMULÁRIO PARA INSERIR OS DADOS.

NECESSITO QUE QUANDO O USUÁRIO ABRIR UM NOVO FORMULÁRIO PARA INSERIR NOVOS DADOS TRAGA OS 6 ÚLTIMOS REGISTRO DE UMA DETERMINADA COLUNA PARA QUE O USUÁRIO CONSIGA VISUALIZAR.

ESSA COLUNA ESTÁ FORMATA NO TIPO ENUM. TRAGA UMA LISTA COM OS ÚLTIMOS 6 REGISTROS DESSA COLUNA. FAZER ISSO PARA CADA EQUIPAMENTO QUE LER O QR CODE.

0 1 61
1 REPLY 1

Here's something I put together with some help from ChatGPT.


To solve this type of problem in AppSheet, you can follow this approach:

Goal:

When a user scans a QR code and opens a form to input data for a specific piece of equipment, display the last 6 values from a specific Enum column related to that piece of equipment. This helps the user view recent history and avoid input errors.

Approach:

  1. Ensure each record is linked to a specific equipment identifier:
    When the QR code is scanned, store an equipment identifier in the form (e.g., [EquipmentID]), which you can use to filter related data.
  2. Add a virtual column or a Show-type column to display recent values:
    This column will display a list of the last 6 values from the Enum column, filtered for the same equipment.
  3. Use this expression to retrieve the 6 most recent values:
    Assuming:
    • Table name: Records
    • Enum column: [Status]
    • Equipment ID column: [EquipmentID]
    • Timestamp column: [Timestamp]
    Expression:
    TOP(
      ORDERBY(
        SELECT(Records[Status], [EquipmentID] = [_THISROW].[EquipmentID]),
        [Timestamp],
        TRUE
      ),
      6
    )
    This returns a list of the last 6 values (most recent first) from the [Status] column, filtered by the current equipment.
  4. Convert the list into readable text (comma-separated):
    To display the list in a Show column as plain text, use:
    TEXT(
      TOP(
        ORDERBY(
          SELECT(Records[Status], [EquipmentID] = [_THISROW].[EquipmentID]),
          [Timestamp],
          TRUE
        ),
        6
      )
    )
    The TEXT() function converts the list into a single string.

Optional Tips:

  • Use a Show column to present the data clearly to users.
  • You can change 6 to any other number of records you want to show.
  • Make sure the source table has security filters or proper access if needed.

This method allows the user to quickly see recent history for each piece of equipment when entering new data.

Top Labels in this Space