[Factory Talk ME] Any way to Not write to a tag when a statement is False

cschlue

Member
Join Date
Nov 2013
Location
Davenport
Posts
34
I'm trying to find out if Factory Talk supports the ability to not write to a tag if the expression is not true.

and an example would be.

Code:
If {PART_SELECT_A} == 1 Then {PROGRAM_1} Else
If {PART_SELECT_A} == 2 Then {PROGRAM_2} Else
If {PART_SELECT_A} == 3 Then {PROGRAM_3} Else
If {PART_SELECT_A} == 4 Then {PROGRAM_4} Else
If {PART_SELECT_A} == 5 Then {PROGRAM_5} Else 
If {PART_SELECT_A} == 6 Then {PROGRAM_6} Else 
If {PART_SELECT_A} == 7 Then {PROGRAM_7} Else 
If {PART_SELECT_A} == 8 Then {PROGRAM_8} Else 
If {PART_SELECT_A} == 9 Then {PROGRAM_9} Else 
If {PART_SELECT_A} == 10 Then {PROGRAM_10}
Else {Part_Selected}

In that example i'm writing the same tag to itself, but this causes issues when i need to loop through several blocks of tags (Since expressions have an incredibly low character limit, which wouldn't matter if parameters worked in tags or there was a way to make a variable tag.) and only the final block will properly write to the tag even though technically it should just re-write the previous true statement.

Any thoughts?
 
Last edited:
I'm not following you 100% for what you are trying to do, but have you checked into using the enter and acknowledge bits on your buttons?
 
Running through a macro to see if a tag is set to a an integer, if it's that integer it writes the corresponding string to the tag.

so if {part_select_a} is equal to 1 it will write {Program_1} to {Program_Selected} otherwise it just reads and writes {Program_Selected} to it's self, since expressions have a character limit doing more then ten options in a macro result in multiple rows looping through sets of ten If statements, but it'll only write the final row successfully.

so instead of having to re-write the tag to itself i'd like to just not write to the tag at all.
 
Last edited:
A screen shot for clarity

2u7naep.jpg
 
What operators do you have available to use in the expression? Do you have a JUMP and LABEL? If so, IF Part_Select_A = SomeNumber, Then Program_SomeNumber AND JUMP to LABEL Else (Next Line)
 
Why not just have static text that says "Program ", and place a numeric indicator after it with the integer value.

You can put a visibility animation on them both so only shows if > 0
 
Why not just have static text that says "Program ", and place a numeric indicator after it with the integer value.

You can put a visibility animation on them both so only shows if > 0

The {Program_*} tags are strings that hold the actual name of the program that they can set in a system menu we have designed so it's more readable to an operator rather then just stating the program number, I've hoped i could do something similar to {Program_{PART_SELECT_A}} but it doesn't appear to accept tags inside of tags.

Why not do it in the PLC?
ME is ok but has limitations, especially if you try to do to much with it....

I'd say that this does fall in the "doing too much" category, but i can't use plc logic to do this unfortunately since this is actually going to be used to build a report on the HMI that saves a Excel document showing runtimes, part counts, ect.

What operators do you have available to use in the expression? Do you have a JUMP and LABEL? If so, IF Part_Select_A = SomeNumber, Then Program_SomeNumber AND JUMP to LABEL Else (Next Line)

I'm more or less doing this now using the IF else statements, i really only have standard mathematics available to me though, no GOTO or Jump functions, just functions that return values based on input.
 
If you use The Display List Selector Then You Could Use Parameter Files To Display the correct name. The Display List has up to 255 options for opening screens And also a parameter option for each selection. Create your List to show programs and reopen the Same Screen with a different Parameter File. This way you will just be refreshing The Parameter and Reopening The Same Screen. Create All Program Names as Memory Tags. Then String Display with The Parameter {#1}. Make 28 parameter files with {#1}= {Program Name Tag}.
 
Ummm....maybe I'm dense, but just leave off the last ELSE and nothing will happen to the tag.
 
If you use The Display List Selector Then You Could Use Parameter Files To Display the correct name. The Display List has up to 255 options for opening screens And also a parameter option for each selection. Create your List to show programs and reopen the Same Screen with a different Parameter File. This way you will just be refreshing The Parameter and Reopening The Same Screen. Create All Program Names as Memory Tags. Then String Display with The Parameter {#1}. Make 28 parameter files with {#1}= {Program Name Tag}.

I've thought about using parameters, but I wasn't sure how to get the tags to be set correctly when choosing a new part, this seems like a good solution. I'll give it a try and let you know how it goes.

Ummm....maybe I'm dense, but just leave off the last ELSE and nothing will happen to the tag.

I wish it was that easy.

Most programming you can do stuff like

Code:
example(){
If foo = bar {
DoSomething();
} Else; {
 }
}
Return;}

And it'll return Nil or no result, which doesn't seem to be the case here, it seems to require some sort of "Result"
 
Most programming you can do stuff like

Code:
example(){
If foo = bar {
DoSomething();
} Else; {
 }
}
Return;}

And it'll return Nil or no result, which doesn't seem to be the case here, it seems to require some sort of "Result"

And most programming you can just do if foo = bar Then DoSomething

With no Else....That's what I'm not getting...Why can't you just do:

If part == 1 Then Program1
Else If part == 2 Then Program2
Else If part == 3 then Program3


There doesn't need to be a final Else.
 
And most programming you can just do if foo = bar Then DoSomething

With no Else....That's what I'm not getting...Why can't you just do:

If part == 1 Then Program1
Else If part == 2 Then Program2
Else If part == 3 then Program3


There doesn't need to be a final Else.

That's exactly what I wish I could do, unfortunately this is what happens when if you don't.

elsestatement.png


Could you just use Vba

It doesn't appear that I can use VBA in ME, I actually installed SE today just to see what the difference was and now i want to do all my projects in SE, but that's an extra cost so I'll have to find a way to "justify" it.
 
Although the question was asked many years ago, I'd like to say that as far as I understand you want sth like this:
If (condition) then {statement} else {do nothing}
In factorytalk expressions editor you can type "If condition then statement else none".
I've just started learning factorytalk and made an animation for a button and wanted it to blink when one tag is true, and keep its original design if false. In order to that just typed to expressions editor:
If {tag}
Then 0
Else none
where 0 is the value in Animation=>Color tab and where you specify colors.

And I use FT View Studio SE:
Release Number: 10.00.00(CPR 9 SR 10)
 

Similar Topics

How to fetch data from Microsoft sql server into ftv? I wanted to create form and store all the data into sql database... Also i need to search...
Replies
1
Views
5,253
Hello all, I would like to write system\seconds tag (Factory Talk View SE) to a plc tag (RSLogix 5000) in order to handle the system\second value...
Replies
8
Views
2,163
  • Poll
How to write a VBA in Factory Talk to read Alarm Tag from Alarm summary and open a display associated to that tag. Or open any desired display...
Replies
2
Views
7,044
Hey All! I have a job where I need to send data to a printer and a bagger, both of which run independently, but get parameters from a screen...
Replies
0
Views
2,865
Looking to find out how to write block transfer tags on rio. Imported a 1000e in to the panelview plus 1500, but the block transfer is not...
Replies
0
Views
2,860
Back
Top Bottom