splitting a serial number to 2 lines based on a certain character Follow

0
Avatar
REN DUTOIT

Hi,

I would like to know if there is an easy VB script that could split my GRN | Serial number from one line of text to two if a certain character is present?

For example, we have parts that have a GRN value and some parts have GRN and a Serial number.

Our Excel database sheet always has both combined but with a "|" character separator. So I want to have two separate lines of values on the Label, one for GRN and one for Serial Number with the script splitting it up when the "|" character is present.

 

Any help would be appreciated.

Thank you.

9 comments

0
Avatar
Pete Thane
Comment actions Permalink

No need to use VB, just use the Transforms> Seach and Replace option

0
Avatar
REN DUTOIT
Comment actions Permalink

Thank you Pete for the quick response.

This does work for me but I was hoping to do this with VB script to keep all our actions in one place rather than relying the the system functions. It also makes backing our files up safer to keep functions and actions.

If you can let me know that would be great,

Thank you.

0
Avatar
REN DUTOIT
Comment actions Permalink

Also, on an unrelated question.

Would there be a way to integrate Bartender to DEAR systems? (https://dearsystems.com/)

The whole export function seems so tedious every time to update our printing database.

Thank you.

Ren

0
Avatar
Pete Thane
Comment actions Permalink

Sorry I dont know anything about that and what database they use etc.

Have you looked at Integration Builder to see if there is anyway to utilise that? Such as at print time the user clicks on a button/function in your DEAR system and then that creates an output file with all the data in it that the integration picks up and automatically prints? 

0
Avatar
Adam Flores Sr
Comment actions Permalink

In regards to using a vbScript option,

Select the "Transform" Tab and select "vb Script"

and type the follwing:

Value = Replace(Value,"|",vbCrLf)

That it's all you need. you can always change the value of the character to replace as needed

I hope this will be useful

Regards

Adam Flores Sr.

 

 

 

0
Avatar
Adam Flores Sr
Comment actions Permalink

in regards to you other question

Would there be a way to integrate Bartender to DEAR systems? (https://dearsystems.com/)

it it's better you submit the question in a separate post

so it can be followed by itself otherwise it will always show as:

splitting a serial number to 2 lines based on a certain character

and you would never see a response to your second questions.

and if possible describe the process your using now.

Regards

Adam Flores Sr.

 

 

0
Avatar
REN DUTOIT
Comment actions Permalink

Thank you very much Adam and Pete for your input.

Pete, your script worked just fine (with some minor alterations)

Now would there be a way to change font style with code to only some text with VB script within that same VB statement?

I did some searching but unsuccessful.

I will also, submit a new ticket on the DEAR question.

Thank you very much,

Ren

0
Avatar
Pete Thane
Comment actions Permalink

There must be a way a to do it as the EU FIC sample label use VB script to bold only the allergens in a data string leaving the non allergens in standard text, but not a clue how to do it.

What I would do would be to make the label field made up of two sub-strings retaining the characters before the | in one string and the rest after it in a second string, probably adding a 3rd carriage return string in between. This would then allow you to set the different fonts/styles for each of the two strings/elements in the full data field without the need for VB 

0
Avatar
REN DUTOIT
Comment actions Permalink

Hi Pete,

Yes, that's the same idea I had but I would much rather keep everything script calculated. I'll keep looking.

Thank you for the input,

Ren

Please sign in to leave a comment.