I noticed that the datamodel does not properly restore a string array.
If an entry of an array contains a comma, that entry is split up.
This caused a lot of problems for us. We now try to avoid commas but it is not an ideal situation.
I am building against the 1.5.0 sdk and here is example code that demonstrates this behaviour:
String [] testArr = {"one, two", "three, four", "five, six"};
System.out.println("array length: " + testArr.length);
for (String s: testArr) {
System.out.println("entry: " + s);
}
/*
array length: 3
entry: one, two
enty: three, four
entry: five, six
*/
model.set("test", testArr);
String[] outArr = model.get("test", new String[0]);
System.out.println("array length: " + outArr.length);
for (String s: outArr) {
System.out.println("entry: " + s);
}
/*
array length: 6
entry: one
entry: two
entry: three
entry: four
entry: five
entry: six
*/
Hello? Any feedback here from UR? Is this a feature @jbm ?
Hi Raphael,
Thank you for the detailed description. I will look into the issue!
Is there an update on this?
We also found that when we save a string array that only contains one empty string and retrieve it, we get an empty array back. When saving a string array with two empty strings for example we get the correct values back. This was very annoying to debug.
Amazing to find the very same issue 5 years later.
I blew my afternoon away on this problem (hunting down StackOverflow issues) and only just discovered it was our array of JointPositions converted to strings that was causing the issue.
Funny enough, this issue only presents itself with both a comma AND a space.
So the way to fix the problem is to remove the space after the comma. This will work for you:
String [] testArr = {"one,two", "three,four", "five,six"};
(My guess is that UR is converting all arrays to strings under the hood, and then using COMMA SPACE as the delimiters for it.)