Can anybody tell me why the following code won't work?
global proc testFunction(string $attribute) { // OK I'm not specifying type here because I want to handle a range of attribute types. $attribValues = getAttr $attribute; }
// Error: line 3: Cannot convert data of type float[] to type float. //
I just don't understand why I'm getting this error, the variable $attribValues is in function scope, so why does it seem to assume the type should be the same as the previous call???
I should also say that if I swap the last two function calls the error is inversed (i.e. "... of type float to type float[]").
The idea was to create a function that can process 'any' attribute on a node.
If anybody can tell me what I'm missing I'd greatly appreciate it!
"I should also say that if I swap the last two function calls the error is inversed" the only way to do that via MEL is to pass in a string, and use stringToStringArray & or regular expressions to break down and parse the string using functional logic, untill a conclusion about what type of data the string contains, after that its a simple casting the data into a varriable of the correct type and returning it.
Post id: 311293 /reported_items/new.html?reportable_id=311293&reportable_type=Discussion%3A%3APost
Hi All,
Can anybody tell me why the following code won't work?
global proc testFunction(string $attribute) { // OK I'm not specifying type here because I want to handle a range of attribute types. $attribValues = getAttr $attribute; }
// Error: line 3: Cannot convert data of type float[] to type float. //
I just don't understand why I'm getting this error, the variable $attribValues is in function scope, so why does it seem to assume the type should be the same as the previous call???
I should also say that if I swap the last two function calls the error is inversed
Theres nothing worng with your code per see. its just that $attribValues happens to be a global name. Try with a different name. Anyway hard to say since youve strupped all the logick of your function so theres no way to help you.