Difference between revisions of "Geopsy: Set header"

From GeopsyWiki
Jump to navigation Jump to search
Line 14: Line 14:
 
<br style="clear: both"/>
 
<br style="clear: both"/>
  
There are various assignment operators:
+
There are various assignment operators woking for numbers and character strings:
* SignalData = value : Set SignalData to value. This operator works for numbers and character strings
+
SignalData = value     // Set ''SignalData'' to ''value''
 +
value1 + value2          // Sum or concatenation operator
 +
SignalData += value      // Set ''SignalData'' to the sum of its previous content with ''value''
 +
value1 == value2  // Returns a bool value, true if ''value1'' and ''value2'' are equal
 +
value1 != value2  // Returns a bool value, true if ''value1'' and ''value2'' are not equal
  
 +
Some assignment operators work only for numbers:
 +
value1 - value2          // Difference operator
 +
value1 - value2          // Multiplication operator
 +
value1 / value2          // Floating point division operator
 +
value1 DIV value2        // Integer division operator. E.g. 5 DIV 2 produces 2
 +
value1 < value2  // Returns a bool value, true if ''value1'' is less than ''value2''
 +
value1 ≤ value2  // Returns a bool value, true if ''value1'' is less than or equal to ''value2''
 +
value1 > value2  // Returns a bool value, true if ''value1'' is greater than ''value2''
 +
value1 ≥ value2  // Returns a bool value, true if ''value1'' is greater than or equal to ''value2''
 +
SignalData -= value      // Set ''SignalData'' to the difference between its previous content and ''value''
 +
SignalData *= value      // Set ''SignalData'' to the product of its previous content with ''value''
 +
SignalData /= value      // Set ''SignalData'' to the ratio between its previous content and ''value''
 +
                            A floating point division is performed
 +
value1 [ value2 ]  // If ''value1'' is an array, the ''value2'' th  element is returned.
 +
                            If ''value1'' is not an array, ''value2'' is ignored.
  
You may also save the current equations in a file (*.headqu) and load it later.
+
 
 +
 
 +
The equations can be saved in file (*.headqu) by clicking on [[Image:SaveButton.png|middle]]. This allows to load the header equation file and set the header of other signals in the same way. To do this hit the button [[Image:LoadButton.png|middle]] and search for the file in the browser window.
  
 
<br style="clear: both"/>
 
<br style="clear: both"/>
  
 
== Examples ==
 
== Examples ==
 +
 +
Modify the name of  signal
 +
Name=mid( ShortFileName,3,5 );
 +
 +
Set the components
 +
tmp=mid( ShortFileName, 12, 1 );
 +
if(tmp=="E",Component="East",  if(tmp=="N", Component="North",  Component="Vertical"));
 +
 +
Set the comments
 +
  Comments="RING01"

Revision as of 10:58, 11 March 2010

This section explains how to modify header information stored in a database in a very efficient way. Any information about signals can be viewed in a table. Signals can be modified one by one by cell editing (Ctrl+K). For huge number of signals this is boring and time consuming. Instead, you can create formulas and apply them with one single click. The syntax for these formulas is rather simple.

General presentation

Dialog box to editing header information

From any active signal viewer (which is by definition a list of signals), click on menu item Edit/Set headers. A dialog box will appear. You can type any number of equations in the left editor. To assist you, for instance for a correct spelling of signal field names, you can use the combos Variables, usual operators and Functions SetHeadersCombos.png


All formulas are separated by ; (like in C). If a line begins with //, all text is ignored until the end of the line (like C comments). The same way, all text included between /* and */ is considered as a comment. Commenting parts of an equation may be interesting to solve errors.

The general syntax is :

SignalData = value.


There are various assignment operators woking for numbers and character strings:

SignalData =  value      // Set SignalData to value
value1 + value2          // Sum or concatenation operator
SignalData += value      // Set SignalData to the sum of its previous content with value
value1 == value2  	 // Returns a bool value, true if value1 and value2 are equal
value1 != value2  	 // Returns a bool value, true if value1 and value2 are not equal 

Some assignment operators work only for numbers:

value1 - value2          // Difference operator
value1 - value2          // Multiplication operator
value1 / value2          // Floating point division operator
value1 DIV value2        // Integer division operator. E.g. 5 DIV 2 produces 2
value1 < value2  	 // Returns a bool value, true if value1 is less than value2
value1 ≤ value2  	 // Returns a bool value, true if value1 is less than or equal to value2
value1 > value2  	 // Returns a bool value, true if value1 is greater than value2
value1 ≥ value2  	 // Returns a bool value, true if value1 is greater than or equal to value2
SignalData -= value      // Set SignalData to the difference between its previous content and value
SignalData *= value      // Set SignalData to the product of its previous content with value
SignalData /= value      // Set SignalData to the ratio between its previous content and value
                            A floating point division is performed
value1 [ value2 ]  	 // If value1 is an array, the value2 th  element is returned.
                            If value1 is not an array, value2 is ignored.


The equations can be saved in file (*.headqu) by clicking on SaveButton.png. This allows to load the header equation file and set the header of other signals in the same way. To do this hit the button LoadButton.png and search for the file in the browser window.


Examples

Modify the name of signal

Name=mid( ShortFileName,3,5 );

Set the components

tmp=mid( ShortFileName, 12, 1 );
if(tmp=="E",Component="East",  if(tmp=="N", Component="North",  Component="Vertical"));

Set the comments

 Comments="RING01"