24. Func='namespace'. Using the internal RXS format: namespace

Example 24.1:

)text out='q1'

name(Peter Jensen)

age(32)

position(bike mechanics)

nationality(danish)

;

name(Hugo Jensen)

position(account manager) age(44)

nationality(danish)

;

name(Niels Olsen) 

age(19) position(CEO) nationality(greek) 

)endtext

)action in='q1'

)&      func='namespace'

if nationality = 'danish' then do

left(name,25)"  "left(position,20)" age:"age

end

)endaction

Output is:

Peter Jensen            bike mechanics          age:32

Hugo Jensen             account manager         age:44

The core principle of the namespace file-format is assigning a value to a variable this way:

variable(value)

A namespace in RXS is a file containing groups of such assignments, the groups separated by ';'.  Refer to the text block in top of example 24.1 above.

Using func='namespace', each group in the file triggers the action block. Example 24.1 contains three groups; accordingly, the action block is triggered three times.

Notice:

A pre screening of the namespace file may be conducted using the variable spacerow.

 

spacerow

Contains the current namespace group in namespace format

 

Example 24.2:

Using spacerow:

)text out='q1'

name(Peter Jensen)

age(32)

position(bike mechanics)

nationality(danish)

;

name(Hugo Jensen)

position(account manager) age(44)

nationality(danish)

;

name(Niels Olsen)

age(19) position(CEO) nationality(greek)

)endtext

)action in='q1'

)&      func='namespace'

)&      out='qspace'

if nationality = 'danish' then do

spacerow

end

)endaction

)action in='qspace'

)&      func='namespace'

left(name,25)"  "left(position,20)" age:"age

)endaction

At first, data is put into the queue 'q1', after which selected groups are copied to the queue 'qspace' from which they are formatted to output in the last action block.

Output will be as in example 24.1