T.run ()

Read(348) Label: pseudo table, expression,

Description:

Define value assignment operation on a pseudo table and return a new pseudo table.

Syntax:

T.run (xi:Fi,…)

Note:

The function defines a computation on pseudo table T, which will compute expression xi, and assign the results to Fi, and returns a new pseudo table.

Parameter:

T

A pseudo table

xi

An expression

Fi

A pseudo table field

Return value:

Pseudo table

Example:

 

A

 

1

=create(file).record(["emp.ctx"])

Below is content of composite table emp.ctx:

2

=pseudo(A1)

Generate a pseudo table object.

3

=A2.run(SALARY+1000:SALARY)

Define a computation on A2’s pseudo table, which will add 1,000 to pseudo table’s field SALARY and assign the results to the field, and return a new pseudo table.

4

=A3.import()

Import data from A3’s pseudo table while executing the computation defined in A3 on A2’s pseudo table, and return the following table:

5

=A2.run(if(GENDER=="F",1,2):GENDER)

Define a computation on A2’s pseudo table, which will compute its field GENDER – return 1 if GENDER field value is F and return 2 if it isn’t – assign the results to GENDER, and return a new pseudo table.

6

=A5.import()

Import data from A5’s pseudo table while executing the computation defined in A5 on A2’s pseudo table, and return the following table: