Syntax for if then else statements in factorytalk view studio

eterc

Member
Join Date
Nov 2021
Location
yhumaide
Posts
6
Hi
I'm starting a new job (so i'm a newbie in ftview programming ) and i have the following problem : I must update some pages in a supervision program but i can not find the correct syntax for my if then else statement

We have several same remote equipements (pumps stations) we reach via a modem. Old modems are in RS232 to communicate with automate, New modem in ethernet.

So in supervision it's the same page we call with a parameter wich tells wich pump we want to access. On this page, we have a refresh button. until now the click on the this button calls the rs232dowload macro.

Now, old modems are replaced by ethernet modems when they crash and id have to add a condition testing the parameter (station name) so when it's an old station i call RS232download macro and when new one i call EThernetDownload macro.

I tried several syntaxes but my condition is always false

Here are some Examples : If (#1 = "Pump1") Then rs22dowload else ethernet download
If (Pumpname == (or EQ) "Pump1") Then rs22dowload else ethernet download
etc..etc...etc...

I debugged and pumpname or #1 are well Pump1 or pump2 or pumpxxx

Factorytalk documentation doesnt show an example of the correct syntax.

I'm seraching since wednesday and i'm completly lost :-(

can someone tell me the right syntax?

Thanks for your help
 
I shouldn't even reply as I am using a completely dif. platform (codesys)
But just in case it helps.
My syntax is:
IF {condition} THEN
{do something;}
ELSIF {condition} THEN
{do something;}
ELSE
call ('867.5309');
END_IF;
 
Last edited:
I believe the problem is with the "ethernet download" part of your statement. Put those in quotes like I just did.

Anytime you have an object with a space in the name you must put it in quotes. Otherwise, it looks at the command and only sees
"Else ethernet". Then it comes to "download" and that is not a valid statement all on its own like that.

Both of the examples below are valid.

If (#1 = "Pump1") Then rs22dowload else ethernet
If (#1 = "Pump1") Then rs22dowload else "ethernet download"

OG
 

Similar Topics

Hi all. I'm building my first Grafcet using Logix, but I started from another project. From what we usually do with other PLC's, I was expecting...
Replies
3
Views
181
Hi. I'm struggling over some basic stuff here. 41001 I is a 16 bits integer that I'm able to read with InTouch. What I need to do is to read...
Replies
1
Views
130
Hello, Im new to Studio 5000 View Designer and i try to make a popup reusable screen. So i create a user-defined screen with 2...
Replies
2
Views
270
When using the Siemens S7-1200 Symbolic Addressing driver, there is no Offset Tag or Index Option I wish to be able to read an array tag for...
Replies
0
Views
704
Hello, Which syntax I need to use for write on value on a “local tag” that have “Machine” as scope? Thanks
Replies
0
Views
459
Back
Top Bottom