Receiving data in Excel

Cascade Connect: Version 4.0
Prev | Chapter 5. Tutorial | Next

# 5.2. Receiving data in Excel

Once you have tested Cascade Connect and know it's working, you are ready to receive data from the data server in a Windows application. This part of the tutorial shows you how to make a simple Excel spreadsheet that can receive data from Cascade Connect. It also covers how to configure Cascade Connect to use the spreadsheet.

| A final version of the spreadsheet, named `testfnl.xls`, is part of the Cascade Connect distribution. It can be used in lieu of creating your own, but it should first be saved as `test.xls`.

## 5.2.1. Set up a spreadsheet

To begin with, you will need a spreadsheet to receive the data.

1. Open Excel and save the blank spreadsheet as `test.xls` in the same folder as your Cascade Connect program (the default installation is `C:\Program Files\Cogent\Cascade Connect`).

2. Type the text `Input =>` into cell B2 and right justify it if you like, for appearance.

3. Click on cell C2 and edit the name field to read `input1`. The name field is the white box located immediately above the upper left corner of the worksheet. Edit the name by clicking in the box, typing in `input1`, and pressing Enter.

4. Save and close the spreadsheet.

## 5.2.2. Edit a configuration file

You also need to edit a Cascade Connect configuration file so that when you call Cascade Connect it starts Excel, brings up your spreadsheet, and loads the information necessary to communicate with Excel.

1. In Windows, open the Cascade Connect Setup window by clicking on the icon in the Cascade Connect group.

2. Click on the Excel button to complete most of the settings you will require.

3. Check the contents of the Program to Launch field and change them to match the path to Excel on your computer, if necessary. You can use the button to find the location of `excel.exe` on your computer.

4. Notice that the Program Argument displays the name of your Excel file, `test.xls`. You should ensure that the path is correct, using the button to verify the path names. Change them as necessary.

5. Select Debug Mode.

6. Delete the `myhost.mydomain.com` text in the Server IP Addresses name entry field and replace it with the name of your data server computer. Then click the Add button.

7. Notice that the DDE and Name Settings have been configured for you, as shown below:

8. You should change the TCP Heartbeat to 10,000 msec.

9. Also change the TCP Timeout to 50,000 msec. These two settings will slow down the heartbeat sent between the data server and Windows, allowing you to read the messages as they are sent between Cascade Connect and the Connect Server.

10. Save the file as `testxls.ini`.

## 5.2.3. Configure a shortcut icon

The best way to access Cascade Connect is with a shortcut icon. The icon you create here defines a link in Windows for Excel.

1. Copy one of the icons that are displayed in the Cascade Connect Windows group.

2. Change the name of the icon to Excel Test.

3. Right click on the icon and display the properties.

4. Ensure that the Target field reads:

           "C:\path_to_executable\cascade.exe" -i testxls.ini

   where `path_to_executable` is the complete form of the directory path to where Cascade Connect is installed on your machine. For example, the default installation path is `"C:\Program Files\Cogent\Cascade Connect"`. If the entry is not correct, edit it.

5. Ensure that the Start in field reads:

           "C:\path_to_executable"

   where `path_to_executable` is the same as above. If the entry is not correct, edit it.

6. Save the new icon properties.

## 5.2.4. Receive the data

1. Using a console on the data server or a telnet session from Windows, type the following at the command prompt:

           demowrite 200

2. In the Excel spreadsheet you should see the input1 field update as the data server data arrives. You may notice that the update of this information is slower in Excel than it was before, when we were simply watching the data arrive in Cascade Connect. This is because Excel has to work hard to update the screen each time a value arrives and this slows down the connection. In all cases we have tested, the Windows client program is the slowest link in the connection, and Cascade Connect will always be faster than the Windows client can accommodate.

Prev | Home | Next
Tutorial | Up | Sending data from Excel

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.