Print Page | Close Window

Using Left Command on Parameter Value?

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22670
Printed Date: 28 Apr 2024 at 2:01pm


Topic: Using Left Command on Parameter Value?
Posted By: cbaldwin
Subject: Using Left Command on Parameter Value?
Date Posted: 13 Sep 2018 at 5:14am
My intent is to scan a bar code from an external source into a Crystal Report as a parameter. The barcode has 36 digits as its value. I want to determine what the first three are so i can use that info in an if/then/else formula. I have tried using the LEFT Command to no avail.

LEFT({?barcode},3)

giving this result
{?b

Does anyone have any direction as to how to accomplish this.



Replies:
Posted By: DBlank
Date Posted: 14 Sep 2018 at 4:59am
what data type are you setting {?barcode} up as?


Posted By: cbaldwin
Date Posted: 14 Sep 2018 at 5:18am
{?barcode} is set up as a string.


Posted By: cbaldwin
Date Posted: 14 Sep 2018 at 5:19am
The bar codes that i'm scanning have alphanumeric values.


Posted By: DBlank
Date Posted: 14 Sep 2018 at 5:21am
I think the issue is that you are not actually getting a scanned value into the report parameter result. I am not sure how to connect a scanned item to an input of the param.


Posted By: cbaldwin
Date Posted: 14 Sep 2018 at 5:35am
I also use a multiple value parameter to get the barcode data populated into {?barcode}. When this is used and the {?barcode} is added to my crystal report that accurate 16 digit value of the barcode is displayed. I just want to be able to manipulate that 16 digit value to evaluate it and then cut off the parts i want.


Posted By: cbaldwin
Date Posted: 14 Sep 2018 at 5:52am
I realize that all of this is probably not necessary but i ended up getting the desired outcome by having variable be equal to the value of {?barcode}. Then the LEFT command worked. I use this formula without the left command when i want to display all the values assigned to a multiple value parameter.

left(

(numbervar max := count({?barcode});

numbervar k := 1;

stringvar output := "";

for k := 1 to max do

(

output := output +{?barcode}[k]+", "

);

numbervar m := len(output);

left(output,m-2))

,3)



Print Page | Close Window