Citect RTrim, UCase and Mid functions not working?

Johnny T

Member
Join Date
Jul 2003
Location
Fife, Scotland
Posts
642
Hi

I'm trying to use the RTrim (trims newlines etc from strings), UCase (converts a string to uppercase) and Mid (accesses part of a string) functions in Citect software.

For some reason, these functions aren't working. I've read the help files and can't see what I'm doing wrong. Its as though the compiler doesn't recognise them.

Here's the relevant section of my code:
 
STRING Code_Split1;

STRING Code_Split2;

STRING Code_Split3;

STRING Code_Split4;

CODE_SEARCH = RTrim(CODE_SEARCH);

CODE_SEARCH = UCase(CODE_SEARCH);

Code_Split1 = Mid(CODE_SEARCH,
1, 2);

Code_Split2 = Mid(CODE_SEARCH,
3, 2);

Code_Split3 = Mid(CODE_SEARCH,
5, 2);

Code_Split4 = Mid(CODE_SEARCH,
7, 2);




By the way, "CODE_SEARCH" is a string defined in the variable tag list.

Anyone any ideas?

Cheers

JT :)
 
You have got your citect VBA and cicode mixed up.

The functions you are calling are VBA functions ie Rtrim but you are defining the variables in the code as cicode function variables.

Either use

Cicode
STRING sVariable

sVariable=StrMid("ABCDEF",1,3);
! Sets sVariable to "BCD".
sVariable=StrMid("ABCDEF",4,1);
! Sets sVariable to "E".


or VBA

Dim strTest as String
Dim strResult as String
Dim lngStartLength as Long
Dim lngFinishLength as Long
strTest = "CitectVBA "
lngStartLength = Len(strTest)
' returns 14
strResult = RTrim(strTest)
' returns "CitectVBA"
lngStringLength = Len(strResult)



Have fun Alan Case





 
Alan

That could well be the problem. Thanks (as always) for the info. I'll try that tomorrow and let you know how I get on.

Many thanks

JT :)
 
In fact.. just tried it now and its worked a treat.

I also changed my RTrim function to StrTrim and thats worked.

What's the pnemonic for the uppercase function (UCase) I tried StrUCase but it doesn't work.. any ideas?

Thanks again.

JT :)
 
Hi Johnny,

What do you reckon to this Citect Stuff - Reason i ask is that a Citect Rep is due on site in a few days promising the world.

I know that they do training, but like yourself if our place goes for it ill have to pick it as i go along.

Cheers mate
Steve
 
Steve

I did the course myself two weeks ago and, to be honest, it wasn't that good. It was a 3 day course and the first two days were taken by a bloke who was new to the software himself! The course consisted of us working through a manual that helps you build a simple brewery project.

Personally, this wasn't sufficient for what I wanted and I'm sure it wouldn't be for most people. The reason being that Citect software utilises a lot of scripting to make up for its lack of elements in the GUI. So, for instance, if you want to talk to a database with your project, you can't just click a menu option "database wizard" and set it all up through there. You have to actually write the code yourself using "CiCode". CiCode is basically a cross between VB script and C++ as far as I can tell.

This has the negative effect of making Citect a very steep learning curve, however, it has the positive effect of making the software very powerful as you aren't restricted at all in what you can do.

The last day of my course was run by a guy called Tom who works for Citect but is 'on loan' to Mitsi and he is very switched on with it all. Sometimes he runs the entire course I'm told.

Three pieces of advice I would offer you if you are seeing the rep and looking to buy the software.

Firstly, buy the Citect software and not MX4. MX4 is the Citect software that has been re-badged for Mitsi and only contains the Mitsi drivers. However if you buy the software from Citect you get all the drivers (Siemens, Allen Bradley etc).

Secondly, if you are going to go on a course. Ask that you get on one that Tom Sabitzer is running as he'll be able to answer all your questions that you may have.

Thirdly, they also run a Cicode course. I was a bit annoyed about this as, it seemed to me for the stuff I needed I would be using a lot of CiCode. Luckily, when I was at Mitsi I asked around and managed to get hold of the Cicode manual they use to run that course from so at least I have a reference point if I get stuck.

In short, I'm only ten days in to my experience of Citect and I've found it to be a difficult learning curve but very powerful software. I'm under the gun because the project I'm working on needs to be installed in just over a week. However, if you have the time to learn the stuff then you'll have a much easier time of it.

And... by the time you've done the course, I'll know loads about it so you can always pop on here with any questions you have and I'll do my best to answer them. I've also found there's a few people who frequent here who know a lot about it too (ivo, Alan etc).

If you need anymore info or have anymore questions mate just ask.

Cheers

JT :)
 
For the functions that you are trying to find, open a cicode file, any file will do, click on the help tab, then click on cicode functions. They are listed in groups. Look in string functions to find the one you need.
Regards Alan Case
 
Sorry JT,

Only just seen your post,Thanks for that mate. Theres a citect office 20 mins from our facility so thats one of the reasons my boss is keen. What ever we Use it will be mostly Interfacing with S7 and possibly Modicon's,But it always good to hear a unbiased opinion.

Thanks again

Steve
 
No problems Steve, you're welcome mate.


I've just bought another week to do my project today so the pressure is off a bit.

Its coming along nicely, the big crunch will to see if it talks to the S5's when I get on site.

I'd be interested to hear how you get on with Citect mate. Keep me informed

Cheers

John
 

Similar Topics

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
68
Hello everyone, In a factory where we installed Citect 7.20 the computer began to show the first signs of end of life. They never considered...
Replies
0
Views
73
I have a running backup of Citect and plc and I want to make a spare PC station so I have installed the win XP and somatic net v6.0 and import the...
Replies
3
Views
121
I am trying to display a variable within a cicode function onto a graphics page. This function queries a SQL database. I can get the value onto a...
Replies
3
Views
286
Looking for some help with the connection issue between Citect 2018 and Top Server v6 for Opto22. I’m setting all this up to communicate with some...
Replies
0
Views
118
Back
Top Bottom