nameCheck()
Checks if the name of a datapoint or name of a project only contains the permitted characters.
Replaces the dpNameCheck() and dpIsLegalName() functions which remain for compatibility reasons!
Synopsis
int nameCheck( string &dpName [, int nameType]);
Parameters
| Parameter | Description |
|---|---|
| dpName | DP or project name. |
| nameType |
Constants that specify the check type:
|
Return value
The function returns 0 if the name only contains permitted characters and otherwise -1. When the function returns -1, it also returns the corrected name (therefore, the syntax contains the "&" character).
Error
Description
Checks if the name of a datapoint or project name only contains the permitted characters. The function also checks multibyte characters. The returned result is 0 (only permitted characters) or -1 (illegal characters). The corrected name is returned in the dpName parameter.
Example
The example checks if the name of the datapoint in the text field is correct. It also writes the corrected datapoint name into the text field after a delay.
main()
{
string dpName1 ="/Datapoint1%";
DebugN("Datapoint name:", dpName1);
TEXT_FIELD1.text = dpName1;
int i = nameCheck(dpName1, 1);
if(i == 0)
DebugN("The datapoint name does not contain any illegal characters:", dpName1);
else
{
DebugN("Datapoint name contains illegal characters");
DebugN("Corrected name: ", dpName1);
delay(3,30);
TEXT_FIELD1.text = dpName1;
}
}
Assignment
Datapoint function
Availability
CTRL
