01-05-2024 10:45 AM
I started experimenting with the Multi Error Cluster library so I can add attributes to each error and read those attributes in a standardized format in another place. I loved the idea that each error becomes a json formatted string, but I ran into some issues.
As shown in the code below, I create an error and add the attribute "TestAttribute" with the value "Something" to my error
but when I try to read all the attribute names, or even the specific attribute by name, I get nothing as you can see in the image below
So after this I tried to parse the json myself, but because of strange formatting, the attribute is never recognized. the value of my "TestAttribute" needs qoutes around it, otherwise it is not recognized as a valid json string as you can see in the following images
When I Edit the Write Error Cluster attribute.vi and add the qoutes around the attribute value, it works.
This bug is as far as I know in LV2020 and LV2021, in LV2023 it is not even possible to add an attribute or encode your error to be a json error.
Solved! Go to Solution.
01-05-2024 02:50 PM
I've reported the Encode issue to LV R&D as Bug 2616790.
For the JSON string issue, this is by design... you have to specify an attribute that is a valid JSON string, so:
Number - 12.3
String - "abcdefg"
Boolean - TRUE
String attributes are in quotes in JSON, which is why the quotes are required.
01-06-2024 07:23 AM
I totally overlooked the input terminal saying JSON Value. Thanks for clarifying!
01-08-2024 05:45 AM
@Darren wrote:For the JSON string issue, this is by design... you have to specify an attribute that is a valid JSON string, so:
Number - 12.3
String - "abcdefg"
Boolean - TRUE
String attributes are in quotes in JSON, which is why the quotes are required.
I need to add the following remark, if anyone is coming to this topic with the same problems. When using booleans the value needs to be lower case.
01-09-2024 04:50 AM - edited 01-09-2024 04:51 AM
All those multi error cluster VIs could use a little (a lot) TLC.
Performance is terrible, as is quite obvious at a first glace in the code.
The multi vs single error tag (not JSON!) is just silly (multi: 1-n error, single: 1 error) and wasting CPU and kludging code .
Error dialogs don't support multi error.
A few simple VIs will make life a lot easier.
Nothing revolutionary, but this could be a quick start: GitHub - Carya-Automatisering/MultipleErrors