Relays only work when the robot is Enabled.
So the compressor will only run while the robot is Enabled by the Driver Station.
There are LabVIEW solenoid examples included in the installation.
Look under the Getting Started window -> Support -> Find FRC examples... -> pneumatics
There are some simple examples spread across
this page too.