How to merge data fields into one bar code with horizontal tabs between each field in Crystal Reports?

We need to be able to write a formula in crystal which combines a job number, assembly number and material number into one bar code.  It must have horizontal tab characters in the bar code between each field of data, this is so that upon scanning, the reader can input the first data into the field on the ERP screen, automatically tab to the next and input the next data etc...

We are using Crystal Reports XI R2 with a Progress DB running the Epicor Vantage ERP Product.

Is this even possible to prevent spending too much time on it? See below for current work in progress:

Formula field in Crystal -

{JobHead.JobNum} + ChrW (9) +
totext({JobMtl.AssemblySeq}) + ChrW (9) +
totext({JobMtl.MtlSeq}) + ChrW (9)

This outputs: '10068 0.00 10.00' when it needs to be '10068 0 10'

I have added the 'totext' function as the syntax requires a string on the second and third DB fields.

Thanks for reading.
THELFBAsked:
Who is Participating?
 
oliffCommented:
try the below;
{JobHead.JobNum} + ChrW (9) + 
cStr(tonumber({JobMtl.AssemblySeq}),0,'') + ChrW (9) + 
cStr(tonumber({JobMtl.MtlSeq}),0,'') + ChrW (9)

Open in new window

0
 
oliffCommented:
The Cstr() function will allow you to output the number as a string, without decimals.

I hope this helps.
0
 
tncodeCommented:
I would recommend Code-128 instead of Code-39. Code-128 encodes tabs better. There is an example at the end of this tutorial http://www.idautomation.com/crystal/barcode-font-formulas.html using multiple fields with Code-128.
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
THELFBAuthor Commented:
Thanks for the speedy replies. I will try both in the morning and get back to you.
0
 
mlmccCommented:
Crystal ToText defaults to 2 decimal places and , as the thousand deparator.

Try changing your formula to

{JobHead.JobNum} + ChrW (9) +
totext({JobMtl.AssemblySeq},0,'') + ChrW (9) +
totext({JobMtl.MtlSeq},0,'') + ChrW (9)

mlmcc
0
 
oliffCommented:
likewise

{JobHead.JobNum} + ChrW (9) +
cStr({JobMtl.AssemblySeq},0) + ChrW (9) +
cStr({JobMtl.MtlSeq},0) + ChrW (9)
0
 
THELFBAuthor Commented:
I have tried mimcc suggested solution but I am getting an error message (see screen shot)
also tried oliff suggestion but get a different error (see second screen shot)

Crystal.png
Crystal2.png
0
 
oliffCommented:
or this to build a stringvar and then test parts at a time, read hashing!
local stringvar output;

// if JobHead.JobNum is a number value, then unhash this and hash the
// stringvar below.

// local stringvar JobNum:=cStr({JobHead.JobNum},0,'');
local stringvar JobNum:={JobHead.JobNum});

local stringvar AssemblySeq:=cStr({JobMtl.AssemblySeq},0,'');
local stringvar MtlSeq:=cStr({JobMtl.MtlSeq},0,'');

output:=JobNum+ChrW (9)+AssemblySeq+ChrW (9)+MtlSeq;

// JobNum; // UNHASH LINE TO TEST JobNum;
// AssemblySeq; // UNHASH LINE TO TEST AssemblySeq;
// MtlSeq; // UNHASH LINE TO TEST MtlSeq;

output; //HASH TO TEST PART OUTPUTS ABOVE

Open in new window

0
 
THELFBAuthor Commented:
Thanks Oliff, this is working, however see the screen shot of the output.  The Barcode won't scan.  I am assuming where the gaps are, it is supposed to have bars representing what the reader can interpret as a horizontal tab?  It is the barcode on the right.

Thanks
Crystal3.png
0
 
oliffCommented:
I think rather than ChrW (9) you'd need to use another character that the reader recognises as a break? Perhaps use +" "+ rather than +ChrW(9)+

(i dont know what ChrW(9) is!)
0
 
THELFBAuthor Commented:
Thanks for the info oliff, the problem now is another question altogether so I'm going to close this one off.
0
 
THELFBAuthor Commented:
Answered my question promptly with extra assistance.  Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.