Type of Variables
Posted: Fri Nov 20, 2015 9:06 am
Hi all,
My first ever post here; I'm hoping this forum will be a really useful resource and maybe I can contribute something over time.
I am kinda brand new to this product set and I'm shadowing a colleague for the time-being. I've got a development background and, for sure, some of this is all going over my head, but I hope to get there. To get to the crux of my question today I'd like to explain what I want to do... I actually want to use the ExecuteProcess function in a TI Process to potentially call a different Process depending upon some logic, and those different Processes might have a different parameter Type - having a different Process being called is fine as that's just a String. I'm finding that my development background might be giving me some misconceptions as to how this stuff works.
Am I correct in my thinking that a Variable you use in a TI Process is not explicitly declared, it is effectively declared through the action of you just using it in code?
Am I also correct that the Type of the variable gets defined automatically?
My issue is that I reckon this code should work, but it doesn't pass the validation that's run on it by the code editor in Architect or Performance Modeler.
It seems that myVariable has a Type assigned to it of Numeric, regardless of whether that line of code would actually be executed. So the 'second' assignment of a String value to myVariable causes an error in the editor. That's kinda OK in my mind if I've explicitly declared myVariable as a Numeric... but I don't think I can do that and, therefore, I'm curious if myVariable can either be a Numeric or a String or whether there is a compilation process happening when I hit "Save" that is concluding myVariable must be a Numeric and cannot be a String... but that's seemingly just because myVariable = 1; comes first, if myVariable = '1'; comes first in the code then it's the assignment of a Numeric that it complains about (still the second assignment in that case).
Does that even make sense?
My first ever post here; I'm hoping this forum will be a really useful resource and maybe I can contribute something over time.
I am kinda brand new to this product set and I'm shadowing a colleague for the time-being. I've got a development background and, for sure, some of this is all going over my head, but I hope to get there. To get to the crux of my question today I'd like to explain what I want to do... I actually want to use the ExecuteProcess function in a TI Process to potentially call a different Process depending upon some logic, and those different Processes might have a different parameter Type - having a different Process being called is fine as that's just a String. I'm finding that my development background might be giving me some misconceptions as to how this stuff works.

Am I correct in my thinking that a Variable you use in a TI Process is not explicitly declared, it is effectively declared through the action of you just using it in code?
Am I also correct that the Type of the variable gets defined automatically?
My issue is that I reckon this code should work, but it doesn't pass the validation that's run on it by the code editor in Architect or Performance Modeler.
Code: Select all
IF (logical expression);
myVariable = 1;
ELSE;
myVariable = '1';
ENDIF;
Does that even make sense?
