File name truncated


metaltest

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?

image.png.d99314eb3268c819ce8364c8aa7364e3.pngimage.png.b170a18ed771446b0d269be6038fb561.png

Link to comment
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()

 

Link to comment
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
Page.Machine_Settings.PopupModal()

Set Channel (from the Edit Box Component)

Page.Page_0.Component.Cust_Machine_(machinesetting).strText

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.