File name truncated

Recommended Posts

I've setup a quick sequence associated with a button to change the file name based on strings entered in text boxes. For some reason the last character of the last variable in the file name is cut off.

Logging.LabJack1.Filename = basedirectory + Page.Page_0.Component.LabJack1Cust.strContents + "_" + Page.Page_0.Component.LabJack1Job.strContents + "_" + Page.Page_0.Component.LabJack1Spec.strContents + ".txt"

As as I added variables the 'C' was cutoff, then the '0' and finally the '3'

How do I avoid this?


Share this post

Link to post
Share on other sites

I'm not a big fan of the edit box in HMI's, so my first suggestion is to consider using a variable value control to display the current settings, and a button next to it that pops up a query for the value.

If you really want to use edit boxes, then my second suggestion is to put them in a popup that only updates the filename when the popup is dismissed with an OK button.  Putting edit boxes on the primary pages of your HMI is a bad idea, for reasons I explain here:

Chances are the issue is that the edit box hasn't lost focus and updated the strContents.  You could use the setFocus() function of any other screen element to force the loss of focus, or you can probably do page.myPage.submit()


Share this post

Link to post
Share on other sites

That totally makes sense.

Is there a way to dynamically read and write multiple variables in the popup?

Like set a global variable to "2" when opening the popup and reference that when opening the popup to set the current values and then use it set the values on submit.

Basically using a variable within a variable.

Quick Sequence code in the Button Component from the main page

machine_settings = 2
Page.Machine_Settings.Component.Customer.strContents = Page.Page_0.Component.Cust_Machine_(machinesetting).strText

Set Channel (from the Edit Box Component)


Share this post

Link to post
Share on other sites

Figured out how to do part of it with the evaluate function, but then realized an array would probably better handle this and then could be used to display data fairly easily in a table element.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now