Cicode Genie

hello,

i am trying to make a Cicode genie for a IF function.

so far this is the cicode i have:

FUNCTION KmrBzttngRichTextFileOpen()

IF +bsKmrNrRTF=1

THEN

DspDel (+AnNr)

+bsKmrNrRTF=0

ELSE

PageRichTextFile (+sAnNr, "D:\CtKamerBezetting\"+sAfdlngRTF+"\"+sKmrNr+".rtf", 2, 200, 275);

+bsKmrNrRTF=1;

End

End

so far most of it i got to work, both the path and the AnNr work.

how ever i cant get the "bsKmrNrRTF" to work.

the idea is that when i press on a grapical genie i put in a variable tag that has to be put in place of the "bsKmrNrRTF".

BsKmrNrRTF is at the moment a LOCAL INT adres.

but has to be replace with a Variable adres that gets its value from the PLC.

i wonder if there is a way to make this work? and what i could do to sort this?

thanks in advance.

Arriën

Parents
  • It looks like your function is designed to display the RTF file the first time you call it, then remove the RTF file from the screen the next time you run the function. The state of the RTF display is stored in a local variable tag. A local tag or a Cicode Module variable would be a good place to store that value so that each client computer has its own copy of the value. Why do you want to store it in a PLC variable? You can do that, but I'm not sure why the PLC needs to know if the operator is looking at a RTF file.

    Note that you should not have + before your variable names in your code. The + sign is for adding two values together, like Tag1 + Tag2. For example, these lines of code:

    PageRichTextFile (+sAnNr, "D:\CtKamerBezetting\"+sAfdlngRTF+"\"+sKmrNr+".rtf", 2, 200, 275);
    +bsKmrNrRTF=1;

    Should be:

    PageRichTextFile (sAnNr, "D:\CtKamerBezetting\"+sAfdlngRTF+"\"+sKmrNr+".rtf", 2, 200, 275);
    bsKmrNrRTF=1;
Reply
  • It looks like your function is designed to display the RTF file the first time you call it, then remove the RTF file from the screen the next time you run the function. The state of the RTF display is stored in a local variable tag. A local tag or a Cicode Module variable would be a good place to store that value so that each client computer has its own copy of the value. Why do you want to store it in a PLC variable? You can do that, but I'm not sure why the PLC needs to know if the operator is looking at a RTF file.

    Note that you should not have + before your variable names in your code. The + sign is for adding two values together, like Tag1 + Tag2. For example, these lines of code:

    PageRichTextFile (+sAnNr, "D:\CtKamerBezetting\"+sAfdlngRTF+"\"+sKmrNr+".rtf", 2, 200, 275);
    +bsKmrNrRTF=1;

    Should be:

    PageRichTextFile (sAnNr, "D:\CtKamerBezetting\"+sAfdlngRTF+"\"+sKmrNr+".rtf", 2, 200, 275);
    bsKmrNrRTF=1;
Children
No Data