Expressions

Expressions are used throughout the Neshoonak selectors to specify or calculate values for table columns and link items. An expression begins with an equal sign (=) followed by a combination of parameters, constants, functions, and operators.


Numbers

Numbers can be written with, or without, decimals (Exmaples: 12 , 12.3). Neshoonak uses Doubledata type as it's internal number type.


Strings

A string can be any text inside quotes. You can use single or double quotes (Examples: 'Neshoonak' , "Neshoonak")


Special Characters

The backslash escape character turns special characters into string characters. This is the list of special characters that can be added to a text string with the backslash sign:

Code Outputs
\' single quote
\" double quote
\\ backslash
\n new line
\r carriage return

Arithmetic Operators

Arithmetic operators are used to perform arithmetic on numbers (literals or variables).

Operator Description
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulus

String Operators

The + operator can also be used to add (concatenate) strings. Using this operator when one of operands is numeric, before calculating the expression, it will be converted to string automatically. For eaxample 'A' + 2 returns 'A2'.


Comparison and Logical Operators

Operator Description
== equal to
!= not equal
> greater than
< less than
>= greater than or equal
<= less than or equal

Logical Operators

Logical operators are used to determine the logic between variables or values.

Given that x = 6 and y = 3, the table below explains the logical operators:

Operator Description Example
&& and (x < 10 && y > 1) is true
|| or (x == 5 || y == 5) is false

Parameters

A parameter begins with an At sign (@) followed by an Id. Flowing table lists all defined parameters.

Parameter Description
@RowNo Returns current row number (starts form zero)
@Index Returns index of current record. It differs from row number, because some rows may be ignored to add in table or link collection.
@PageName Returns name of current page-pattern
@RequestUrl Returns the requested url
@ResponsetUrl Returns the response url
@Url Returns response url if exists, otherwise returns request url
@Time Returns current time in 'HH:mm:ss' format
@HHMM Returns current time in 'HH:mm' format
@Date Returns extraction date
@DateTime Returns extraction datetime in format of 'yyyy/MM/dd HH:mm:ss'
@DateHHMM Returns extraction datetime in format of 'yyyy/MM/dd HH:MM'
@Shamsi Like @Date but for solar hijri calendar
@ShamsiTime Like @DateTime but for solar hijri calendar
@ShamsiHHMM Like @DateHHMM but for solar hijri calendar
@DocumentText Returns html text of downloaded webpage
@Method Returns the method (Usually 'GET' or 'SET') used to download webpage
@QueryString Reutrns querystring part of @Url
@QueryString.<query name> Returns the value of <query name> in @QueryString
@args.argument name Returns the value of <argument name> in @args collection
+ Note: arguments are stored as string. To caonvert to integer multiply them by 1 (for exmaple: @args.Level * 1 ) .
+ Note: Arguments are used to pass values between webpages.
@param.<user parameter name> Returns the value of <user parameter name> in @param collection
+ Note: parameter are stored as string. To caonvert to integer multiply them by 1 (for exmaple: @param.MaxLevel * 1 ) .
+ Note: End user parameter values are held in @param collection.

Functions

All functions defined in common scripts can be invoked from expressions. These functions should always return a string / number. For example:
= MyFunc(1, 2)

In common scripts write the function body (C# syntax) :

  public int MyFunc(int a, int b)
  {
	return a + b;
  }
  

Examples

Expression Description
= @Index Record index in table
= @args.Level*1 + 1 Converts Level argument to integer and adds it by 1
+ Note: all @args & @param are stored as string
= @args.Level*1 < @params.MaxLevel*1 Converts Level argument and MaxLevel param to integer and returns true if Level is less than MaxLevel.
+ Note: all @args & @param are stored as string

  Loading...