Hi,
I’m trying to refactor some code to take advantage of the deep reading of objects in 8.1, as stated here:
docs
I have found that this syntax only works for documents that have alpha numeric keys.
See example below:
The memory tag ([Development]DocTag) has a value as follows:
"value": {
"data": {
"alphaNumeric1": "alpha numeric 1",
"1": "this key is a number",
"has spaces": "this key has spaces"
}
}
I can only read the keys that are alphanumeric. Any keys that are a number or contain spaces result in a malformed path exception.
Results (with. [key.deepKey] notation:
print system.tag.readBlocking(["[Development]DocTag['data']"])
>>> [[{alphaNumeric1=alpha numeric 1, 1=this key is a number, has spaces=this key has spaces}, Good, Mon Nov 23 10:19:40 CAT 2020 (1606119580207)]]
print system.tag.readBlocking(["[Development]DocTag['data.alphaNumeric1']"])
>>> [[alpha numeric 1, Good, Mon Nov 23 10:19:40 CAT 2020 (1606119580207)]]
print system.tag.readBlocking(["[Development]DocTag['data.1']"])
>>> [[null, Error_Exception("Malformed path: data.1"), Mon Nov 23 10:31:32 CAT 2020 (1606120292149)]]
print system.tag.readBlocking(["[Development]DocTag['data.has spaces']"])
>>> [[null, Error_Exception("Malformed path: data.has spaces"), Mon Nov 23 10:31:32 CAT 2020 (1606120292153)]]
Same with [‘key’][‘deepkey’] notation:
print system.tag.readBlocking(["[Development]DocTag['data']"])
>>> [[{alphaNumeric1=alpha numeric 1, 1=this key is a number, has spaces=this key has spaces}, Good, Mon Nov 23 10:19:40 CAT 2020 (1606119580207)]]
print system.tag.readBlocking(["[Development]DocTag['data']['alphaNumeric1']"])
>>> [[null, Error_Exception("Malformed path: data']['alphaNumeric1"), Mon Nov 23 10:36:42 CAT 2020 (1606120602222)]]
print system.tag.readBlocking(["[Development]DocTag['data']['1']"])
>>> [[null, Error_Exception("Malformed path: data']['1"), Mon Nov 23 10:36:42 CAT 2020 (1606120602226)]]
print system.tag.readBlocking(["[Development]DocTag['data']['has spaces']"])
>>> [[null, Error_Exception("Malformed path: data']['has spaces"), Mon Nov 23 10:36:42 CAT 2020 (1606120602229)]]
Is this a bug or am I doing something wrong?
Regards,
Deon