date



TIS Table Info

Getting started

The name of TIS tables in the database is normally not the same as in TIS table directory. To get the database name you have to use the XIH function.

Preparation

Create a data node without reference to another node. Add the operation "Create Table" with one column and one row. Header and input for this table are temporary and don't influence the operation itself.

Formula Operator

Add an operation to the node and choose formula operator with an Text as result column type.
The input for the TIS table information is:

XIH.TISTable("string TISTablePath", "string TISTableName") 


Result

The path an Name of the table.

Additional possibilities

You can also get the information for one or more TIS tables

  • by using TIS Parameter for the path and/or table names.
  • or by using the operator "Read TIS Table information" as parent operation

Using Resources to switch between different languages

Getting started

TIS supports switching between languages, and many things are directly accomplshed
with using resources. However, you may want to use resources in formulae. The following functions help.

This helps to set the user language in a parameter (only if it changes)

Typically resources are defined with just two characters, but you may want to distinguish de-de, de-at ....

(
((string)XIH.GetParam("USER_LANGUAGE")) == XIH.CurrentLanguage() ? "" :
(XIH.SetParam("USER_LANGUAGE", XIH.CurrentLanguage()) &&
XIH.SetParam("USER_LANGUAGE_SHORT", XIH.CurrentLanguage().Substring(0,2))? "":"")
)

Example

XIH.GetResourceText("Warning_Date_als_Zahl", "de")
XIH.GetResourceText("Warning_Date_als_Zahl", ((string)XIH.GetParam("USER_LANGUAGE_SHORT")))

Additional Tipp

The operator Read TIS resources gives you a full list.

Generating Passwords

Getting started

XIH allows generating random passwords with given parameters, such as length, necessary characters.

Function

string XIH.Password(int length) 
string XIH.Password(int seed, string alphabet, int length) 
string XIH.Password(int seed, int length) 
string XIH.Password(int seed, string alphabet, int length)

length (int): length of the password

alphabet (string): characters that should be included in the password (eg: 123, abc, ABC, !"§, …)

seed (int): number that defines which password should be generated

Encryption and Decryption

Getting started

This function encrypts a text string. The result can be decrypted later again.

Function

string XIH.Encrypt(string text) 
string XIH.Decrypt(string encryptedText)

Getting database info

Getting started

This XIH functions informs you, which database (Oracle, MSSQL, POSTGRES) is actually used by the system which again
helps you to properly build SQL statements in the formula operator that may be used Importing data from SQL sources 5.0 via Parameters

Function

(XIH.DatabaseInfo).IndexOf("(ORA") > 0 ... Oracle
(XIH.DatabaseInfo).IndexOf("(PGSQL") > 0 ... PostgresSQL
otherwise it is MSSQL

Check Email Address

Getting started

This XIH functions checks whether an email address is formally correct.

Function

bool XIH.IsValidEmail(string emailAddress)

User Name of Account User

Getting started

If a higher number of users get access to the [TIS]Board Account Users are generated. The normally get activated only if they are logged in to the [TIS]Board. If you need to find out the account user for a calculation this XIH function is essential.

Function

string XIH.AccountId()

Syntax

Note that you must omit the brackets in the Formula operator (row-by-row) (4.0) = Formeloperator: XIH.AccountId

Result

null or "" if it is a normal user and not a Pool user

Single-Sign-On Parameter

Getting started

In context of a single sign on (SSO) a list of parameter, value tuples are transferred.

Note that you must define a Logon-Event on the TIS-Board, which recalculates a data node using this function. Later the parameters are not available anymore. See also Event Handling with Portlets.

Function

string XIH.GetLogOnParam(string name, string default_value)

Example

XIH.GetLogOnParam("t", "-")
XIH.SetParam("USER", (XIH.GetLogOnParam("t", "-").ToString() != "-" ? XIH.UserName : XIH.Encrypt(XIH.GetLogOnParam("t", "-").ToString()))) 

führt zu transparenter Eintrag falls User in Liste der bekannten User ist zu encrypted wenn Pool-User 

XIH functions

Please note: XIH functions do NOT allow # in the notation of variables. Example: write "Identifier" instead of "#Identifier#".

See also XIH Functions

Examples

 

Key word 

Formula / Example  

Same ID: Calculate time to previous

   XIH.IsFirst(null) == false && 
   XIH.GetString("Identifier",-1) == #Identifier# ? 
        (XIH.GetDateTime("To",-1) - #From#).TotalHours 
        : 0

Overwrite data

<condition> ? <return_value_if_true> : <return_value_if_false>   
#Course number# == 0 ?  XIH.SetInt("Course number", XIH.GetInt("Course number", -1)) : true
  • if the value of #course number# in the current row is 0 then take the value of the previous row

  • creates a boolean type column

Looking for a specific time and editing it if the condition is met.

(#Bis#.Hour == 14.0 && #Bis#.Minute == 51.0) ?
XIH.SetDateTime("Bis", #Bis#.AddHours(8.0)) : false

Do week day, time or ID change with regard to the previous row?

XIH.EqualsPrev("Identifier") == false ||
XIH.EqualsPrev("Weekday") == false ||
XIH.EqualsPrev("Timeofday") == false ? 1 : (XIH.GetInt("Count",-1) + 1)

Do week day, time or ID change with regard to the following row?

XIH.EqualsNext("Identifier") == false || 
XIH.EqualsNext("Weekday") == false ||
XIH.EqualsNext("Timeofday") == false ? 1 : (XIH.GetInt("Count",-1) + 1)

One can do several calculations and assignments to 
cells or parameters in one step

EXAMPLE USING ERROR CODES as Integers

#Quantity# == 0 ? 0 :
((XIH.SetDouble("Pause in h", #Pause in h#/#Quantity#) ? 0:9) +
 (XIH.SetDouble("Netlength in h", #Nettolength in h#/#Quantity#) ? 0:99) +
 (XIH.SetDouble("Net/Gross in %", #Net/Gross in %#/#Quantity#) ? 0:999) +
 (XIH.SetDouble("Length in h", #Length in h#/#Quantity#) ? 0:9999))

If errors occur, a value unequal to zero will be returned. Depending on the variables, 9, 99 ...

The same without error codes but with boolean values:

#Quantity# == 0 ? true : 
( XIH.SetDouble("Pause in h", #Pause in h#/#Quantity#) 
&& XIH.SetDouble("Netlength in h", #Nettolength in h#/#Quantity#) 
&& XIH.SetDouble("Net/Gross in %", #Net/Gross in %#/#Quantity#) 
&& XIH.SetDouble("Length in h", #Length in h#/#Quantity#)
)
Here only true or false is returned

 

Snippets

 

Key word 

Resulting column 

Description  

Code  

Merge Data=0 Records

Delete

  • goes through rows and expands From-To
  • afterwards delete all rows with Delete = 1
 XIH.EqualsPrev("Id") && #Data# == 0 && XIH.GetDouble("Data", - 1) == 0 ?
  (XIH.SetDateTime("From", XIH.GetDateTime("From",-1)) 
   && XIH.SetDouble("Delete",-1,1) ? 0:0 ) : 0

Categories - eg 000-050; 050-100 ...

Text

Creates categories with three digits out of values with Steps (Variable available in formula operator)

 #Data# == 0 ? "-" :
((System.Math.Floor((#Data# - 0.00000001)/#Step#)*#Step#)
   .ToString("000") + "-" +
((System.Math.Floor((#Data# - 0.00000001)/#Step#)+1)*#Step#)
   .ToString("000"))

Conversion of "", "8h20", "12h30" ... into numbers 0.00, 8.33, 12.5

and standardisation of text into "00h00", "08h20", "12h30"

Double & change of original value

Goes through, changes original text, and calculates the number

(XIH.SetString("Column-name", #Column-name#.Trim()) ? 0:0)
+ (XIH.SetString("Column-name", 
      XIH.IsNull("Column-name") || 
      #Column-name# == "" ? "00h00" :#Column-name# ) ? 0:0)
+ (XIH.SetString("Column-name", 
      (#Column-name#.Length == 4 ? "0" : "") +#Column-name#) ? 0:0)
+ System.Convert.ToInt32(#Column-name#.Substring(0,2))
+ System.Convert.ToInt32(#Column-name#.Substring(3,2))/60.0

 

Access table for programmers

 

Type

Description

XimesData.GenTable

Object Table

XimesData.GenRow2

Object Table row

XimesData.ColumnType

Object Table column

 

Function/Property

Resulting value

Description

dataRow.Parent

XimesData.GenTable

Returns the row of the current table.

dataRow.Parent[i]

XimesData.GenRow2

Returns the i-th row of the current table.
The first row has index 0.

dataRow.Parent[i][j]

object

Returns the value of column j in row i.
Indices of rows and columns always start with 0.

Since the values are always of the type object, they need to be converted to the right type for further processing.

Example: Access to decimal number in 4th column (columns start with index 0) in the first row.
System.Convert.ToDouble(dataRow.Parent[0][3])

dataRow.Parent.CountCols

Number

Returns the number (quantity) of the columns, including newly created columns.