property()

Here’s how to use property() function.

f. property()

Description:

Retrieve property value from the property file.

Syntax:

f.property(p)

Note:

The function retrieves property p from property file f and return.

Parameter:

f

File object

p

Property name; the function returns a table sequence composed of all properties if it is omitted

Option:

@v

Read a property value and parse it as what it is; by default, return the value as a string

Return value:

Value/Table sequence

Example:

A normal scenario:

 

A

 

1

=file("E://test.property").property("color")

Property file, export “red .

2

=file("E://test.property").property()

 

Scenario of reading color scheme for a graph:

The color scheme file is [installation directory]\esProc\classes\config\chartcolor.properties. A color scheme format is color scheme name=[color1,color2,….]:

 

Set colourful8 as the color scheme for the column graph:

 

Note:

To use the color schemes in plotting a graph, make sure that the class path can be loaded onto the config directory. esProc default design is that the config directory is already put into [installation directory]\esProc\classes. To view the effects of color schemes on server side, users need to create a config folder in the service’s [applicaton root directory]\WEB-INF\classes unless there’s already a config folder there and copy the color scheme file chartcolor.properties under it.

Related function:

f.read()

f.write()

xs.property()

Description:

Read property values from node strings.

Syntax:

xs.property(n,v)

Note:

The function returns values under node n in node strings xs. Set n’s value as v if string parameter v is present, and delete n if v is absent.

Parameter:

xs

Node strings, whose format isname1=value1 name2=value2...

n

Node string name; return a table sequence made up of all properties when it is absent

v

Null or a string

Option:

@c

Separate node strings by commas or semicolons; use spaces by default

@j

Use colons to separate node string name and its value; use the equal sign by default

@q

Enclose values by double quotation marks

@v

Read the string and then parse it into value; return a sequence by default

Return value:

A value/a sequence

Example:

 

A

 

1

color=red size=20 price=500

 

2

=A1.property("color","blue")

Change the value of node string named “color” into “blue” .

3

=A1.property@q("size")

Enclose the value with double quotation marks.

4

=A1.property@v("size")

Read the string first and then parse it into a value.

5

color:red;size:20;price:500

 

6

=A5.property@cj("color",)

Use @c option to separate node string by semicolons; use @j to separate node string name and value by colon; since the value of “color” is null, delete the node from the node strings.