# RowCount

## **Specs**

| Label                     | Value                         |
| ------------------------- | ----------------------------- |
| **Version**               | 2.5.0 (updated on 2025-04-14) |
| **Developer**             | Labii Inc.                    |
| **Type**                  | Column                        |
| **Support Configuration** | Yes                           |
| **Support Readonly view** | Yes                           |
| **Support Edit view**     | No                            |
| **Support Form view**     | No                            |
| **Support Default value** | No                            |
| **Support Import**        | No                            |
| **Allow multiple**        | Yes                           |

## Overview

The RowCount widget is a versatile tool designed to streamline the process of displaying row counts within a user interface. Specifically tailored for displaying row counts, this widget operates efficiently by returning the count of rows based on a provided query. By seamlessly integrating into various applications, it offers developers a convenient solution for showcasing the quantity of rows within a dataset or database table, enhancing user experience and facilitating data analysis with clarity and precision.

## Use case

* Return the number of bio specimens generated from a host.

## Configuration

To enable the widget's functionality, it requires the following settings.

* **Table** - Select a table to limit the query. If you want to search across different tables, leave it empty.
* **Query** - You can use the query string after the '?' from the advanced search, or you can use one or more filter sids.\
  \
  Variables that can be replaced:\
  {{SID}} - The SID of the current record.\
  {{UID}} - The UID of the current record.\
  {{NAME}} - The name of the current record.\
  \
  Examples:\
  1\. name=test\
  2\. filter\_\_sid=xxx
* **Stop condition** - The formula will stop calculation when the condition is met. It must return a `true` or `false` value. This field does not support other column data, you can only use the variable `data` to reference the current record data.
* **Should auto update when readonly** - If checked, this widget will perform a live calculation when readonly.

### Example

```json
{
    "table": {"sid":"xxx", "name":"xxx"}, # the table to limit the query
    "query": "name__icontains=test", # (requried)
    # paste the query
    # Some variables can be added to the link. The widget will replace it for you:
    # {{SID}}, the sid of the current record.
    # {{UID}}, the uid of the current record.
    # {{NAME}}, the name of the current record.
    "format": {}, # the number in the wNumb format. 
    # Learn more at https://refreshless.com/wnumb/
}
```

## Views

See the interface of the widget in the following views.

### **Readonly view**

Readonly view display the values of the column.

<figure><img src="https://github.com/Labii/labii-gitbook-docs/blob/gitbook/widgets/.gitbook/assets/widget-column-rowcount-readonly.webp" alt=""><figcaption></figcaption></figure>

Press the Update button to refresh the count value.

### **Edit view**

The Edit view is the interface that allows you to modify the value.

Edit view is not supported for this widget.

### **Form view**

The Form view is the field integrated into the add form for collecting values when creating a new record.

Form view is not supported for this widget.

## Data

Each widget in Labii stores data in a unique manner; refer below to understand how data from this widget is stored.

### Data format

Any data return from the formula.

### **Default value**

The Default Value field within the column allows you to specify the default value when a record is created.

Default value is not supported for this widget.

### **Import value**

The Import Value is the value you need to include in your Excel table for it to be imported into Labii.

Import value is not supported for this widget.
