FTViewSE/ME: Converting integer/real to string in Expression

bevanweiss

Member
Join Date
Sep 2009
Location
Melbourne
Posts
39
Hi all,
I've got a bit of a need to convert an integer (and a real in another situation) to a string with a particular format.
This seems possible to do with a straightforward numeric display, but alas, I need this in the URL connection for a WebControl... (it's used to assemble a URL which then calls a web service to return a DataMatrix 2D barcode with GS1 formatting).

I'm really trying to avoid having int/real -> string conversions within the PLC (the FTView display has index parameters meaning the displayed value could come from a large number of possible 'slots'.. doing int->string for each of them would be a bit painful.
 
Does FTView have access to VB or VBA or VBS? Or does it have its own scripting language?
_
 
Last edited:
FTView Studio ME does not have access to VBA, SE does. It is kind of a PITA to work with though. I have never done web control in any of my applications, so I am most likely way off base here, but what about a simple expression for the URL connection? Something like "https://www.datamatrixurl.com/" + #1 + "--" + #2? That should produce something like "https://www.datamatrixurl.com/INT--STRING". I don't currently have access to View Studio to test this, and I can't remember if parameters need to be in curly braces or not.
 
FTView Studio ME does not have access to VBA, SE does. It is kind of a PITA to work with though. I have never done web control in any of my applications, so I am most likely way off base here, but what about a simple expression for the URL connection? Something like "https://www.datamatrixurl.com/" + #1 + "--" + #2? That should produce something like "https://www.datamatrixurl.com/INT--STRING". I don't currently have access to View Studio to test this, and I can't remember if parameters need to be in curly braces or not.

The issue is that the PLC value of #1 might be 1 (as integer) but I need it displayed as '01'.
Ditto with the #2 where in the plc it might be 3.002 (as real tonnes) but I need it as '003002' (kgs, 6 digit 0 padded).

It would have been beautiful if I could have had:
https://www.datamatrixurl.com/" + format(#1, "00") + "--" + format(1000*#2, "000000")
But format() just isn't valid here..
 
Does FTView have access to VB or VBA or VBS? Or does it have its own scripting language?
_

It does have some VBA. So certain events can be actioned, like _Clicked / _Changed etc etc. on exposed objects.
The challenge then becomes getting all the other values.
And because I'd like this as a templated thing (Global Object) the VBA becomes a little trickier also (I can't have page level VBA only object level, and no custom subroutines, since they would sit with the display not the object)
 

Unfortunately it does not (well not directly). Because this is a URL for a webcontrol, it needs to be an expression on the URL connection. I can't just have it as a Text control... I think...

If the Text control supported the _Changed VBA event then it could have been magical... if I could have hooked up a _Changed event and read out the 'Value' of the Text which hopefully would have been after the final conversions etc.. that would have been exactly what I would have wanted to dump into the web control .URL field...
But alas, no _Changed event.. only user driven click etc
And the final displayed text doesn't appear to be exposed to VBA as a field
 
right("00000" + round(1000*#2,0), 6)

?

  • ROUND(1000*3.002,0) should yield 3002
  • "00000" + 3002 should yield the string "000003002"
  • RIGHT("000003002",6) should yield the string "003002"
 
Last edited:
Up front: Not familiar with the structure of your program.

… I can’t wrap my head around why one might marry themselves to FTView ME by dint of tailoring a solution around it.

Can you shed more light on this one?
 
right("00000" + round(1000*#2,0), 6)

?

  • ROUND(1000*3.002,0) should yield 3002
  • "00000" + 3002 should yield the string "000003002"
  • RIGHT("000003002",6) should yield the string "003002"


That's a negative.
JrXMP2w

https://ibb.co/JrXMP2w
VBA is not supported in the Expression. Only associated with events on components (like Text, Numeric Display/Control, String Display/Control etc)

Which then takes me into the dark hole of having a copy-paste of the same code to create the full URL embedded in each and every field that makes up the URL.. which seems horrible.

So far the front runner is having a mimicing field in the PLC on the UDT which does the string stuff, and trying to keep it in sync as best as possible... it's an L85 so there's memory and cycles to just throw on the floor (at least today)..
 
Last edited:
Up front: Not familiar with the structure of your program.

… I can’t wrap my head around why one might marry themselves to FTView ME by dint of tailoring a solution around it.

Can you shed more light on this one?

FTViewSE is the operator display platform. Presenting the 2D datamatrix is an operator display problem. If there is a shortcoming in the FTViewSE product (i.e. not being able to readily format the string representation of an integer/real) that seems like an FTViewSE tailored solution to resolve it..

If I was instead using WinCC, then I would expect workarounds to WinCC limitations to be quite tailored to the WinCC platform.

It's why I'm really trying to avoid hacking up the PLC code to accommodate these limitations. If in the future the visualisation gets swapped to WinCC/Citect/Ignition/MagicSCADAPlatform 2.0 I don't want crud taking up PLC space and cycles when it's not required.
 

Similar Topics

I am attempting to access HMI tag properties (Description, Minimum, Maximum values) to populate a numeric input. Is there a clean way to do this...
Replies
0
Views
374
Hello everyone. I'm asking for help with the following problem: in FTView SE 13.00 for the AlarmEventSummary1 object, you need to add the filter...
Replies
0
Views
599
I want to have two displays that uses the same VBA variable "vbaint". But when I change between them, the variable seems to reset. How can I do...
Replies
4
Views
2,816
I'm begginer at VBA. What should be the correct way to check if a display is currently showing and then show another display? I tried to put this...
Replies
17
Views
8,378
I have a alarm banner A display that shows on the botton of the screen and that must shown along with any of two specific main centered displays...
Replies
2
Views
2,041
Back
Top Bottom