Example Code

Create a Remote Front Panel with an Attachment

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

 

Overview
This document explains how to create a remote front panel using LabVIEW and the instructions to modify the created html to include an Excel or text file.
Description
You can monitor an application created in LabVIEW using remote front panels, however, sometimes you require to have access to the acquired data that is being stored in a .xlsx or .txt file in the deployment computer. One approach is to save the acquired data directly to a server, a second approach, that is described in this tutorial is to store the data locally and then access it through a remote front panel.

 
Requirements

  • LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

For this tutorial to work, the host and remote computers should be on the same subnet. Additionally, you should know the IP address of your computer. To obtain

  1. Create an application that saves data locally
    1. Make sure you save the data to LabVIEW <version>\www directory, you can use a Default Directory file constant and a build path VI with a constant www\filename.txt
  2. Create a remote front Panel Using LabVIEW
    1. After you have created and saved your VI, select Tools>>WebPublishing tool
    2. Select the VI you want to publish and if you wish to have remote control
    3. Click Start WebServer and click Next
    4. Edit your Document Title, Header and Footer, click Next
    5. Don't change the local directory to save the Webpage, notice the html you are creating will be saved in the LabVIEW <version>>>www directory, the name of the html will be the name you assign to Filename
    6. Copy the URL to your clipboard so that you can paste it on an Internet Explorer window later
    7. Click Save to Disk
    8. Click OK
  3. Modify your html file
    1. Navigate to Program Files>>National Instruments>>LabVIEW <version>>>www
    2. Open the html file you just created in Notepad (the name of the file will be the same you choose on step 1.5)
    3. Add the following code line after <TITLE> Your title </TITLE> <a href="http://your IP adress:8000/filename.txt">Download Log</a>
    4. Save and close the text file
  4. Test
    1. Run your VI
    2. Navigate to the URL you copied in step 2.6 on Internet Explorer (there is no support for Firefox or Chrome yet)
    3. If the webpage asks you to install an ActiveX control, install it
    4. The webpage you opened will show you your front panel with your title, header and footer. You will find a link called Download Log right after your title.
    5. Click Download Log a new window will show up with your log. If you use a xlsx file instead of a .txt make sure to change the file extension in 3.3. The new webpage will allow you to download the current Excel file.

 

Example. Implement Attached Code Only

If you only wish to implement the solution.

  1. Download the attached folder and extract it.
  2. Repeat the steps in the previous section using “Temperature Monitor 2012 NIVerified.vi” as the test VI

 

 

Additional Information or References

 

 

 **This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.