Modifying Forms Input with VBScript for Text on a Label Follow

0
Avatar
Sean Seago

Is it possible to select a date in the calendar on a form, modify that data with vbscript, and then use the output of the vbscript as text on the label?

The issue is this:

We have small labels which need to contain a lot of information.  We have an algorithm which we would like to apply to the date information so it will take up less space on the label, but we don't want the date in it's original format to be present on the label.

In this case, for example, 2017-06-21 is encoded as 2320K1.  The trick here is that we can't be certain of the date that will go on the label until it's printed.

3 comments

0
Avatar
Shotaro Ito
Comment actions Permalink

You can use Object Value to refer other text's value and modify that.

Create a text (TxtDate)off-label (outside of the template) so it won't be printed.

Link Calender control to the text (TxtDate).

Create a text on the label (TxtDate2). Change data source from Embedded data to Object Value, of TxtDate.

On TxtDate2's datasource, you can apply Transforms (Search and Replace or VB Script.)

On VB script transform, you can modify value like

’Change 01-31 to A-_
Value = CHR(64 + CINT(MID(Value,9,2)))

 

0
Avatar
Sean Seago
Comment actions Permalink

Most of my experience is with C++ and Python so my natural inclination is to try to get the value of TxtDate with something like "TxtDate.Value" but this isn't valid in VB Script.

As I don't spend much time working with VB Script, and I haven't been able to find any documentation that has been helpful, I was wondering if you can you elaborate on what you meant by "Change data source from Embedded data to Object Value, of TxtDate."  Perhaps with some example code using the label names you mentioned in your previous reply.

0
Avatar
Sean Seago
Comment actions Permalink

Going through the motions again, I see what you meant.  By using TxtDate as the Object Value (in the text properties dialog) and then performing a VB Script transformation under the Transformations tab, I was able to get the desired result. 

 

Thank you so much!

Please sign in to leave a comment.