on ‎2019 Mar 04 4:01 PM
Hi,
I'm trying to develop an application with SAP Crystal Reports, developer version for Eclipse ver 2.0.24.
When I try to run a report with barcode I've got the error:"
UFL 'u2lbcode.dll' that implements this function is missing".
I've developed my application starting from CRJavaHelper class.The others kind of report work well. In the path
C:\eclipse\plugins\com.businessobjects.crystalreports.crsdk.libs_12.2.225.r3524\lib I can find the library
com.azalea.ufl.barcode.1.0.jar, and I can see that in the package explorer in Eclipse. Other information:
I'm runnig my project on Windows 7 64bit.
Someone can help me? Because I don't know how to solve it.
Thanks in advance
Request clarification before answering.
thanks for the document.
I tried it, but I haven't been able to make the UFL file jar. Because I never made before, please could you help me?
I did these steps:
1) Add external JAr (CrystalReportsRuntime.jar, CrystalCommon2.jar) in my new project;
2) I wrote the code;
3)I made a jar file from Eclipse;
4)In the previuos step I saved my jar file as com.azalea.ufl.barcode.1.0.jar, exactly the same the original file, and put it in the same path.
5)I ran my project wth the report but didn't work.
this is the code that I wrote:
// FUNCTION LIBRARY
package com.azalea.ufl;
import com.crystaldecisions.reports.formulas.FormulaFunction;
import com.crystaldecisions.reports.formulas.FormulaFunctionLibrary;
public class BarcodeLibrary
implements FormulaFunctionLibrary
{
private final FormulaFunction[] functionArray = { new Code39(), new Code39Ascii() };
public FormulaFunction getFunction(int functionNumber)
{
return this.functionArray[functionNumber];
}
public int size()
{
return this.functionArray.length;
}
}
//MY FUNCTION
package com.azalea.ufl;
import com.crystaldecisions.reports.common.CrystalResourcesFactory;
import com.crystaldecisions.reports.common.value.FormulaValue;
import com.crystaldecisions.reports.common.value.FormulaValueType;
import com.crystaldecisions.reports.common.value.StringValue;
import com.crystaldecisions.reports.formulas.FormulaFunction;
import com.crystaldecisions.reports.formulas.FormulaFunctionArgumentDefinition;
import com.crystaldecisions.reports.formulas.FormulaFunctionCallException;
import com.crystaldecisions.reports.formulas.FormulaValueReference;
import com.crystaldecisions.reports.formulas.SimpleFormulaFunctionArgumentDefinition;
public abstract class Code39Base
implements FormulaFunction
{
FormulaFunctionArgumentDefinition[] myArguments = { SimpleFormulaFunctionArgumentDefinition.string };
protected CrystalResourcesFactory resCrystal;
public Code39Base()
{
this.resCrystal = new CrystalResourcesFactory("Messages");
}
protected final String doTranslation(String inputData)
{
String returnVal = "";
char[] dataChar = inputData.toCharArray();
for (int i = 0; i < dataChar.length; i++) {
returnVal = returnVal + translateCharWrapper(dataChar[i]);
}
returnVal = "*" + returnVal + "*";
return returnVal;
}
public final FormulaValue evaluate(FormulaValueReference[] arguments)
throws FormulaFunctionCallException
{
StringValue dataStringArg = (StringValue)arguments[0].getFormulaValue();
String dataString = dataStringArg.getString();
String returnVal = doTranslation(dataString);
return StringValue.fromString(returnVal);
}
public final FormulaFunctionArgumentDefinition[] getArguments()
{
return this.myArguments;
}
public final FormulaValueType getReturnType()
{
return FormulaValueType.string;
}
protected abstract String translateChar(char paramChar)
throws InvalidBarcodeDataException;
private String translateCharWrapper(char theChar)
{
String returnString;
try
{
returnString = translateChar(theChar);
}
catch (InvalidBarcodeDataException e)
{
returnString = "";
}
return returnString;
}
public void validateArgumentValues(FormulaValueReference[] arguments)
throws FormulaFunctionCallException
{}
}
package com.azalea.ufl;
public class Code39Ascii
extends Code39Base
{
private String[] c39Chars = { "%U", "$A", "$B", "$C", "$D", "$E", "$F", "$G", "$H", "$I", "$J", "$K", "$L", "$M", "$N", "$O", "$P", "$Q", "$R", "$S", "$T", "$U", "$V", "$W", "$X", "$Y", "$Z", "%A", "%B", "%C", "%D", "%E", "_", "/A", "/B", "/C", "/D", "/E", "/F", "/G", "/H", "/I", "/J", "/K", "/L", "-", ".", "/O", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "/Z", "%F", "%G", "%H", "%I", "%J", "%V", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "%K", "%L", "%M", "%N", "%O", "%W", "+A", "+B", "+C", "+D", "+E", "+F", "+G", "+H", "+I", "+J", "+K", "+L", "+M", "+N", "+O", "+P", "+Q", "+R", "+S", "+T", "+U", "+V", "+W", "+X", "+Y", "+Z", "%P", "%Q", "%R", "%S", "%T" };
public String getIdentifier()
{
return "barcodec39ascii";
}
protected String translateChar(char theChar)
throws InvalidBarcodeDataException
{
if (theChar >= this.c39Chars.length) {
throw new InvalidBarcodeDataException(theChar, this.c39Chars.toString());
}
return this.c39Chars[theChar];
}
}
//EXCEPTION
package com.azalea.ufl;
public class InvalidBarcodeDataException extends Exception{
private static final long serialVersionUID = 1L;
private char barcodeData;
private String allowedCharacters;
public InvalidBarcodeDataException(char theBadChar, String theAllowedCharacters)
{
this.barcodeData = theBadChar;
this.allowedCharacters = theAllowedCharacters;
}
public String getMessage()
{
return "Invalid Barcode Data (" + this.barcodeData + ") Allowed Characters are: " + this.allowedCharacters;
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 7 | |
| 6 | |
| 4 | |
| 4 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.