New Line In Drop Down List Text For Data Source
I have created a data entry form that has a drop down list to select a location we are shipping from.
Each location has a different address such as shown below
Location 1
Address Line 1
Address Line 2
Location 2
Address Line 1
Address Line 2
The user will select the location, and the three address lines will show on the label.
Issue I have is the wrapping of text in the text box for the address
How do I make a new line for each of three lines so the address appears correctly ?
Is there a way of embedding the new line in the "list Items" Data Source Values something like "Location 1<<CR>>Address Line 1<<CR>>Address Line 2"
Thanks
Ron
-
I'm afraid that this type of control objects (drop down list, list box...) don't support directly imputing control characters for the data source value of each item on the value list.
Through a VB Script you could force entering a carriage return (using the Chr(13) command or the already built in vbCr command), but these control objects recognize the carriage return as a change in listed items (you'll get a different item for each of your separated strings).
In order to get this done, you'll need to set up a character which won't be used on the actual values of the location and address names and do a "search and replace" action on the actual text object.
1. Firstly make sure you are working with a multi-lined text object (a paragraphed text object).
2. If you are running BarTender v10, double click on the text object where this information will be loaded, click on the data source node, access the "Transforms" tab and open the "Search and Replace" options dialog to add the search and replace action.
3. On the other hand, if you have an older version of BarTender, you'll need to use a VB Script applied to the text object to get this done (the "Search and Replace" feature was added in v10).
a. Double click on the text object to access its properties, under the "Data Source" tab click on the "More Options..." button.
b. Access the "VB Scripting" tab, activate the use of VB Script and click on the "Edit..." option to enter the Script Assistant (the VB Script should be added in the "OnProcessData" event).
c. You'll need to use the Replace() function with the following structure:
[i]Replace(expression, find, replacewith)[/i]
If, for example, you use the "%" character to mark the carriage return the VB Script used should look like this:
[i]Value = Replace(Value, "%", Chr(13))[/i] (note you can use both Chr(13) or vbCr)
And, on this example, you'll need to enter the information in the control list control object as "Location1%Address1%Address2"0 -
[quote name='Fernando R-Seagull Support' timestamp='1342437085' post='2843']
I'm afraid that this type of control objects (drop down list, list box...) don't support directly imputing control characters for the data source value of each item on the value list.
Through a VB Script you could force entering a carriage return (using the Chr(13) command or the already built in vbCr command), but these control objects recognize the carriage return as a change in listed items (you'll get a different item for each of your separated strings).
In order to get this done, you'll need to set up a character which won't be used on the actual values of the location and address names and do a "search and replace" action on the actual text object.
1. Firstly make sure you are working with a multi-lined text object (a paragraphed text object).
2. If you are running BarTender v10, double click on the text object where this information will be loaded, click on the data source node, access the "Transforms" tab and open the "Search and Replace" options dialog to add the search and replace action.
3. On the other hand, if you have an older version of BarTender, you'll need to use a VB Script applied to the text object to get this done (the "Search and Replace" feature was added in v10).
a. Double click on the text object to access its properties, under the "Data Source" tab click on the "More Options..." button.
b. Access the "VB Scripting" tab, activate the use of VB Script and click on the "Edit..." option to enter the Script Assistant (the VB Script should be added in the "OnProcessData" event).
c. You'll need to use the Replace() function with the following structure:
[i]Replace(expression, find, replacewith)[/i]
If, for example, you use the "%" character to mark the carriage return the VB Script used should look like this:
[i]Value = Replace(Value, "%", Chr(13))[/i] (note you can use both Chr(13) or vbCr)
And, on this example, you'll need to enter the information in the control list control object as "Location1%Address1%Address2"
[/quote]
This worked perfect. Thanks so much.
We are using version 10. I like the new search and replace feature.
Ron0 -
Im still having trouble with this topic Ron,
So basically i want 2 database fields read on separate lines of the QR Code. When I scan it, it should appear on separate lines. I followed the procedure you mentioned above and this is what I have in my VB Script.
Description1= Replace(Description, "%", vbCr).
I have tried multiple ways of doing this. I believe i am getting messed up with the value since the error comes back as, "This script did not read the value property..." Any chance you can help me figure out how to display each of my database fields on different lines?
Thank You
Brett
0 -
Shotaro Ito
★ BarTender Hero ★
"This script did not read the value property" can be just ignored. That shown when you run OnProcessData script without reading Value (original datasource.)
Besides you don't have to use VB script - Create 3 data sources in the QR code.
1: Database Field 1
2: <<CR>><<LF>> (or <<CR>>) input from Omega (Ω) button
3: Database Field 2
if you want to omit line break when field 2 is empty, on datasource #2's Suppression transform, suppress when next datasource is empty.
0 -
Does anyone know how to do this in version 11?
0 -
It is here
0 -
I don't understand where you are going with that. I can create multiline text objects. But, the question is about multiline drop down lists. We have a short list of addresses (3) and want to be able to select one of them to fill in the address box. While the above posts addresses that for other versions, it seems to work differently in version 11. The omega symbol does not exist where you enter the data for the drop down list.
0 -
Sorry yes, this would work. On your multiline text object add a Search and Replace routine from the Transforms and make sure that character being searched for appears in your data such the below that is looking for a | character
Whilst the Dropdown list data looks like this with the | in between each data element. Dont forget to link your list item to your multiline field
0 -
We don't have that Transform in our version (11 aka 2016)?
0 -
Ah, that would be a problem unless you upgraded to a newer version.
You maybe to set this up with one field but I normally use two to do something like this as it makes it easier to diagnose if there is an issue when it is being configured.
- Drag your existing field off the side of the label and go into the Properties of it and make is a Named Data Source (via the Change Name button on the Data Source tab)
- Add a new paragraph text filed onto your label and make this a VB Script > Event Controlled Script and then click the Edit script button
- In the column on the left scroll down to the OnPostPrompt option and add this to the central coding area
Value = Format.NamedSubStrings("TheInput").Value
Value = Replace(Value, "|", vbCrLf)
To make sure the link in the 1st line works correctly type the Value = and then in the column on the right double click on the named data source set above, I had called mine TheInput
As you can see the code is replacing the | character with a carriage return and line feed after the option has been selected from the Dropdown list on the Data Entry Form
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
10 Kommentare