How Can I Programmatically Get the Size of a Citadel Database in LabVIEW?

Updated Apr 23, 2025

Environment

Software

  • LabVIEW
  • LabVIEW Datalogging and Supervisory Control Module

Operating System

  • Windows

This article describes a way to programmatically determine the size of a Citadel database in LabVIEW running in a Windows environment. 

1. Start by creating your database using LabVIEW, through the Create Database VI, or with NI MAX. 

  • When using LabVIEW, you can place the Create Database VI to generate a new database as shown in the image below.
Create Data Base
  • When using NI MAX to create a new database, you can complete the following steps:
1. Right-click on Historical Data and select Create New. 
 
Create new database in MAX
2. Select the type of database to create (Citadel 5 Database) from the Create New Wizard and click on Next.
 
Create new database wizard
3. Follow the instructions to create the database. Provide its location, path, and name. Once you are done, click on Finish. 
 
Database information

2. Log the required data to your recently created database. There are several methods that you can use to achieve this task. Please refer to the following article that explains how you can log data to a Citadel database.

3. Use the following LabVIEW snippet to programmatically determine the size of your database in Windows. 

Get database size programmatically
Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram
 
As you can see, the above LabVIEW code utilizes the System Exec VI to execute the dir command in the Windows Command Prompt. When being run over a folder, the command will list the total number of files, their cumulative size, and the free space (in bytes) remaining on the disk. 
 

After specifying the database path and running the VI, you should get a result similar to the picture that is shown below.

Database size.png