Jasper string functions method undefined error - function

Using Jasper Reports 5.6.1. Added some text functions to a previously working text field jrxml (just want to truncate if longer than 75 chars). Works in iReport Studio, but not in Java.
<textFieldExpression><![CDATA[IF(LEN($F{AccountName})<75,$F{AccountName},LEFT($F{AccountName},75)+"...")]]></textFieldExpression>
Error message:
Error occured while trying to fetch the HTML Output from the Jasper Service (Errors were encountered when compiling report expressions class file:
1. The method LEN(String) is undefined for the type ICC_1422636250096_198427
value = IF(LEN(((java.lang.String)field_AccountName.getValue()))<75,((java.lang.String)field_AccountName.getValue()),LEFT(((java.lang.String)field_AccountName.getValue()),75)+"..."); //$JR_EXPR_ID=9$
<->
2. The method LEFT(String, int) is undefined for the type ICC_1422636250096_198427
value = IF(LEN(((java.lang.String)field_AccountName.getValue()))<75,((java.lang.String)field_AccountName.getValue()),LEFT(((java.lang.String)field_AccountName.getValue()),75)+"..."); //$JR_EXPR_ID=9$
<-->
3. The method LEN(String) is undefined for the type ICC_1422636250096_198427
value = IF(LEN(((java.lang.String)field_AccountName.getOldValue()))<75,((java.lang.String)field_AccountName.getOldValue()),LEFT(((java.lang.String)field_AccountName.getOldValue()),75)+"..."); //$JR_EXPR_ID=9$
<->
4. The method LEFT(String, int) is undefined for the type ICC_1422636250096_198427
value = IF(LEN(((java.lang.String)field_AccountName.getOldValue()))<75,((java.lang.String)field_AccountName.getOldValue()),LEFT(((java.lang.String)field_AccountName.getOldValue()),75)+"..."); //$JR_EXPR_ID=9$
<-->
5. The method LEN(String) is undefined for the type ICC_1422636250096_198427
value = IF(LEN(((java.lang.String)field_AccountName.getValue()))<75,((java.lang.String)field_AccountName.getValue()),LEFT(((java.lang.String)field_AccountName.getValue()),75)+"..."); //$JR_EXPR_ID=9$
<->
6. The method LEFT(String, int) is undefined for the type ICC_1422636250096_198427
value = IF(LEN(((java.lang.String)field_AccountName.getValue()))<75,((java.lang.String)field_AccountName.getValue()),LEFT(((java.lang.String)field_AccountName.getValue()),75)+"..."); //$JR_EXPR_ID=9$
<-->
6 errors
)
I checked packages in jasperreports-5.6.1.jar file, includes functions package. Exhaustive web search turned up nothing. What could it be?

I have a similar error message. Where you able to resolve this? Works fine in Jaspersoft Studio 6.0.1, but throws this when compiling w/ Java:
The method IF(boolean, BigDecimal, BigDecimal) is undefined for the type Blank_A4_1_1423164610392_674232
Update: I was able to solve this by including the functions jar on my classpath. See that if that works for you. See jasperreports-functions-5.6.1.jar at http://sourceforge.net/projects/jasperreports/files/jasperreports/JasperReports%205.6.1/

When using GlassFish, verify that you have all jasper libraries on your production server. They should be under glassfish/domains/domain1/lib/ext. If the jars are not there (or some of them, such as the fonts or some other not non-requisite lib) you might experience the behavior you are describing.

Related

Was there a change from PrimeFaces 10.0.0 to 11.0.0 that made TreeNode into a Raw Type?

Now, when I define a TreeNode List such as:
List node = otherNode.getChildren();
I get two warnings.
For the left side: "TreeNode is a raw type. References to generic type TreeNode should be parameterized"
For the right side: "Type safety: The expression of type List needs unchecked conversion to conform to List"
This also creates a code breaking issue when trying to use a for loop to iterate though the list like this:
for(TreeNode loopingNode : node.getChildren())
{
...
}
I receive an actual error: "Type mismatch: cannot convert from element type Object to TreeNode"
These issues were only raised when upgrading from PrimeFaces 10.0.0 to PrimeFaces 11.0.0. Why would this be? I have looked through the migration guide (https://primefaces.github.io/primefaces/11_0_0/#/../migrationguide/11_0_0), but I do not think I see anything about this.
Yes. See:
https://github.com/primefaces/primefaces/pull/7525/files#diff-76612635b2ee16c50bf86c76f7b8400e887e790e9ba89e18fb4e79694f4454d1
https://github.com/primefaces/primefaces/issues/7523
This was added in 11.0.0 RC 1. I'll add a note to the migration guide.

How to set INetFwPolicy2::ExcludedInterfaces property

I implementing basic library to deal with Windows Firewall API.
I faced with strange result with INetFwPolicy2::ExcludedInterfaces property.
I set excluded interface via Firewall.cpl and when read property I got array of some guids. I am not sure from where this GUID come. It is not Interface GUID. I select all interfaces from Win32_NetworkAdapter and there no such GUID.
Also when I try assign this value back I got invalid argument or not found errors.
This code based on msdn example written on on VBS, but it really does not matter I have same error on C. Original example did not works either.
Const NET_FW_PROFILE2_PRIVATE = 2
Set fwPolicy2 = CreateObject("HNetCfg.FwPolicy2")
CurrentProfiles = fwPolicy2.CurrentProfileTypes
if ( CurrentProfiles AND NET_FW_PROFILE2_PRIVATE ) then
InterfaceArray = fwPolicy2.ExcludedInterfaces(NET_FW_PROFILE2_PRIVATE)
if (IsEmpty(InterfaceArray)) then
WScript.Echo( "InterfaceArray is Empty" )
else
WScript.Echo( Join(InterfaceArray) )
end if
fwPolicy2.ExcludedInterfaces(NET_FW_PROFILE2_PRIVATE) = InterfaceArray
end if
Check your csproj file xml in your executing assembly (not necessarily the assembly that uses windows-firewall-api if it is referenced). For each configuration there is a <PropertyGroup> tag, and each should have a child tag <Prefer32Bit>false</Prefer32Bit> (or at least the one that you compile with).

How to set TRANSFORMER_KEY argument in my Java client code?

I am working jasperserver for past few days. I want to export the jasper report to HTML page using webservice(SOAP). If I run the client code I got the following exception:
com.jaspersoft.jasperreports.license.LicenseException: No license provider found
at com.jaspersoft.jasperreports.license.LicenseManager.requireProvider(LicenseManager.java:94)
at com.jaspersoft.jasperreports.license.LicenseManager.requireFeature(LicenseManager.java:112)
at com.jaspersoft.jasperreports.fusion.FusionUtils.requireFusionFeature(FusionUtils.java:50)
at com.jaspersoft.jasperreports.fusion.BaseHtmlHandler.getHtmlFragment(BaseHtmlHandler.java:48)
at net.sf.jasperreports.engine.export.HtmlExporter.writeGenericElement(HtmlExporter.java:1414)
at net.sf.jasperreports.engine.export.HtmlExporter$CellElementVisitor.visit(HtmlExporter.java:2595)
at net.sf.jasperreports.engine.export.HtmlExporter$CellElementVisitor.visit(HtmlExporter.java:2513)
at net.sf.jasperreports.engine.fill.JRTemplateGenericPrintElement.accept(JRTemplateGenericPrintElement.java:164)
at net.sf.jasperreports.engine.export.HtmlExporter$TableVisitor.visit(HtmlExporter.java:2484)
at net.sf.jasperreports.engine.export.HtmlExporter$TableVisitor.visit(HtmlExporter.java:2468)
at net.sf.jasperreports.engine.export.tabulator.ElementCell.accept(ElementCell.java:57)
at net.sf.jasperreports.engine.export.HtmlExporter.exportTable(HtmlExporter.java:583)
at net.sf.jasperreports.engine.export.HtmlExporter.writeLayers(HtmlExporter.java:1461)
at net.sf.jasperreports.engine.export.HtmlExporter$TableVisitor.visit(HtmlExporter.java:2508)
at net.sf.jasperreports.engine.export.HtmlExporter$TableVisitor.visit(HtmlExporter.java:2468)
at net.sf.jasperreports.engine.export.tabulator.LayeredCell.accept(LayeredCell.java:65)
at net.sf.jasperreports.engine.export.HtmlExporter.exportTable(HtmlExporter.java:583)
at net.sf.jasperreports.engine.export.HtmlExporter.writeLayers(HtmlExporter.java:1461)
at net.sf.jasperreports.engine.export.HtmlExporter$TableVisitor.visit(HtmlExporter.java:2508)
at net.sf.jasperreports.engine.export.HtmlExporter$TableVisitor.visit(HtmlExporter.java:2468)
at net.sf.jasperreports.engine.export.tabulator.LayeredCell.accept(LayeredCell.java:65)
at net.sf.jasperreports.engine.export.HtmlExporter.exportTable(HtmlExporter.java:583)
at net.sf.jasperreports.engine.export.HtmlExporter.exportPage(HtmlExporter.java:486)
at net.sf.jasperreports.engine.export.HtmlExporter.exportReportToWriter(HtmlExporter.java:378)
at net.sf.jasperreports.engine.export.HtmlExporter.exportReport(HtmlExporter.java:236)
at flying.JSClientTest.main(JSClientTest.java:87)
I just google this error and got a reference from jasper community. They said to pass an argument named TRANSFORMER_KEY having net.sf.jasperreports.transformer.html as value.
Ref links:
http://community.jaspersoft.com/wiki/jasperreports-server-license-issue-when-invoked-web-service
http://community.jaspersoft.com/wiki/how-execute-reports-containing-fusion-charts-web-services
But I have no idea how to pass this argument in my client code.

Unable to load a CLR UDT in Sql Server using CREATE TYPE

I created a UDT using C# and compiled it using .NETFW 2.0. I added it to the database successfully, and can see it when I do "select * from sys.assemblies"
I am now trying to consume the UDT defined in the assembly as follows:
CREATE TYPE dbo.SourceLocation
EXTERNAL NAME MyAssembly.[example.com.SourceLocation];
However, when I do this, I am getting an error as follows:
Msg 6244, Level 16, State 1, Line 1 The size (0) for
"MyAssembly.example.com.SourceLocation" is not in the valid range.
Size must be -1 or a number between 1 and 8000.
Any idea what I could be doing wrong? I can see the type when I run ildasm.exe.
I added the assembly using the command line. I am not using a VS Database project for this.
Do you have the source file?
Check the MaxByteSize attribute?
If it is not there then add it or change the value e.g.
[Serializable]
[SqlUserDefinedType(Format.UserDefined,
IsByteOrdered = true, MaxByteSize = 32)]
[CLSCompliant(false)]
public struct Currency : INullable, IComparable, IBinarySerialize
{

converting toList() throws exception Object must implement IConvertible

I am getting this exception "Object must implement IConvertible." while converting rules to tolist(). below is my code
var rules = from m in db.Rules select m;
return rules.ToList().ToDataTable(); // exception occurs here
I am using MySQL 6.3.6 ..the same code is working fine with MSSQL.
I will be grateful if someone helps me in this
regards
Umair
Make sure the source type is convertible to the destination type.
Probably the rules.ToList() don't match with you ToDataTable destination cast.
Can you verify what var list = rules.ToList() contains?
And... I suggest deal with List and IEnumerable against Datatable.