Citect - Passing tags between Functions ?

EICS

Member
Join Date
Dec 2008
Location
Melbourne, Australia
Posts
323
Another Cicode question if i may.

i have 2 Functions in cicode one function calls the other and i need to pass 2 Variables from one to the other and possibly a return value.

Would like to keep the 2 different functions rather than roll into one.

FUNCTION
Test_A()

String sTagD;
Int iTagF;

code;
code;
IF Code THEN
sTagD = "something";
iTagF = 5;
Test_B();
ELSE
Code;
END
RETURNED ! Returned Value from Test_B
code;
code;
END


FUNCTION
Test_B(sTagD, iTagF)


String sTagH;
INT iTagK;

code;
code;
IF Code THEN
sTagH = "Something Else";
ELSE
Code;
END
RETURN to Test A???? ! Return INT iTagK value Back to FUNCTION Test_A

END
 
Last edited:
Try This.

Code:
[B]FUNCTION[/B]
Test_A()
INT a,b
STRING sResult = ""
      a=16;
      b=8;
      sResult = Test_B(a,b);//TEST_B() function returns a STRING. 
                            //INT a & b are passed to Test_B()

END//

STRING//<<Data type of return data (the default datatype is INT)
[B]FUNCTION[/B]
Test_B(INT x, INT y)//<<int x & y passed from Test_A()
STRING sSum
       sSum = InttoStr(x + y);
RETURN sSum;//<<sSum is the value Returned
END//
 
your code works a treat, many thanks.


i now just have to modify it for what i need in my functions.


Thanks chelton.
 
Last edited:
Try This.

Code:
[B]FUNCTION[/B]
Test_A()
INT a,b
STRING sResult = ""
      a=16;
      b=8;
      sResult = Test_B(a,b);//TEST_B() function returns a STRING. 
                            //INT a & b are passed to Test_B()

END//

STRING//<<Data type of return data (the default datatype is INT)
[B]FUNCTION[/B]
Test_B(INT x, INT y)//<<int x & y passed from Test_A()
STRING sSum
       sSum = InttoStr(x + y);
RETURN sSum;//<<sSum is the value Returned
 END//


can this be modified to Pass 3 Variables as per Below? can the section in RED be changed for say iTag_A, iTag_B, iTag_C or is the x,y,z convention need to be used?



Code:
[B]FUNCTION[/B]
Test_A()
INT a,b,c
STRING sResult = ""
      a=16;
      b=8;
      c=4;
       sResult = Test_B(a,b,c);//TEST_B() function returns a STRING. 
                            //INT a, b & c are passed to Test_B()

END//

STRING//<<Data type of return data (the default datatype is INT)
[B]FUNCTION[/B]
Test_B[COLOR=Red](INT x, INT y, INT z)[/COLOR]//<<int x, y & z passed from Test_A()
STRING sSum
       sSum = InttoStr(x + y + z);
RETURN sSum;//<<sSum is the value Returned
 END//
[/quote]
 
can this be modified to Pass 3 Variables as per Below? can the section in RED be changed for say iTag_A, iTag_B, iTag_C or is the x,y,z convention need to be used?



Code:
[B]FUNCTION[/B]
Test_A()
INT a,b,c
STRING sResult = ""
      a=16;
      b=8;
      c=4;
       sResult = Test_B(a,b,c);//TEST_B() function returns a STRING. 
                            //INT a, b & c are passed to Test_B()

END//

STRING//<<Data type of return data (the default datatype is INT)
[B]FUNCTION[/B]
Test_B[COLOR=Red](INT x, INT y, INT z)[/COLOR]//<<int x, y & z passed from Test_A()
STRING sSum
       sSum = InttoStr(x + y + z);
RETURN sSum;//<<sSum is the value Returned
 END//
[/QUOTE]


Absolutely. You can pass more arguments. Different Data types. Variable names dont have to be x,y,z it was just showing an example.
But you do have to pass the correct number of arguments and correct data type to the function being called.
 

Similar Topics

Hi All, I am trying to pass a variable from Genie to Supergenie. I created a supergenie page with a whole lot of texts, custom genies and numeric...
Replies
4
Views
2,857
Hi All, I'd like to know the best way to go about passing more than 8 variable to a super genie. I'd like to create a genie that will need to...
Replies
5
Views
8,482
So i've been at this for a long while, i have Citect Scada 2018, i have full access to everything but i can't seem to find any option or...
Replies
0
Views
61
Hello, i've been at this for months now, i tried creating accounts on the aveva website but it seems to never approve my accounts or at least when...
Replies
3
Views
86
Hello, I have a running project on Citect v5.42 and simatic net v6.4 I have created a new spare PC and loaded all software like Citect, station...
Replies
0
Views
73
Back
Top Bottom