JasperReports Text Field Expression doesn't really let me put in anything except a variable or field reference - jasper-reports

Referencing the page number variable in JasperReport as $V{PAGE_NUMBER}. Of course that works fine. However, I would like this report to have a page number preceded by a letter, as in:
A-1
A-2
...
A-N
Unfortunately, this does not appear to be permitted. Even when I get the expression editor to accept an expression, it still fails to compile. Always with "cannot cast from String to Integer", or "cannot cast from Integer to String" errors, or sometimes both.
"A-".concat($V{PAGE_NUMBER}.toString()) does not work. No possible variation works, mystifyingly.

Just a note, you can write it as "A-" + $V{PAGE_NUMBER}

Yeah, you can't teach smart. I neglected to change the field type from Integer to String. And I was about to disparage an awesome free product. D'Oh.

Related

emacs orgmode table use the equal sign without starting a formula

I'm typing up a table with org mode, where the equal sign(=) if the first character in the cell and it want to start a formula. how do I get it to display the symbol without it being a formula, of a way to use formulas to display it. I get errors when I use single quotes, and I see the Unicode decimal value when using double quotes.
I have tried the following
='=+'
="=+"
they give
#ERROR
[61, 43]
Use an escaped entity, \equal{} and it should display as you wish. See the variable org-entities for others you can use.
I'm a bit late :D
There may be a better way, but you can try with :='(format "=+")
Source: https://emacs.stackexchange.com/questions/19183/can-i-use-formula-to-manipulate-text-in-org-mode-table
When I ran into this problem just now, I found that I was able to get around it by replacing the equals sign with some other similar-looking character. Two which come to mind are ꞊ ‘U+A78A MODIFIER LETTER SHORT EQUALS SIGN’ and ⹀ ‘U+2E40 DOUBLE HYPHEN’.

Ogg metadata - Vorbis Comment end

I want to implement a class to read vorbis comments. I know that a field will start with a field name, followed by an equal sign and the value. But how does it end? Documentation makes me think that a semicolon will end the field but I checked an ogg file with a hex editor and I cannot see any.
This is how I think it should look like in a file :
TITLE=MY SUPER TITLE;
The field name is title, followed by the equals sign and then the value is MY SUPER TITLE. And finally the semicolon to end the field.
But instead inside my file, the fields look like this :
TITLE=MY SUPER TITLE....
It's almost as above but there is no semicolon. The .'s are characters that cannot be displayed. I thought okay, it seems like the dots represent a value that will say "this is the end of the field!!" but they are almost always different. I noticed that there are always exactly 4 dots. The first dot has always a different value. The other free have usually a value of 0. But not always...
My question now, how does a field end? How do I read this comment?
Also, yeah I know that there are libraries and that I should use them instead of reinventing the wheel over and over again. I will use libraries later but first I want to know how to do it myself. Educational purpose only.
Each field is preceded by a little-endian 32-bit integer that indicates the number of bytes to read. You then convert the bytes to a string via UTF8.
See NVorbis' implementation (LoadComments(...)) for details.

String in parentheses

I recently have seen an expression in Crystal. It's a formula, when I edit it, its content is something like this:
("sNumber") + ":"
However, when I print this report, the code above will become: Number:
I think ("sNumber") is something like a variable. But I cannot find where it is be declared. I searched a lot on web but I find nothing.
So my question is:
Where can I find it?
How can I edit its value?
Any help would be welcome!
UPDATE:
I tried some expression, and find out all string after "s" will be displayed on the report, and those before "s" will be removed.
Maybe it's just some string expression not in document. If someone knows the specification, please add below.
After some further test, I have to say it is not a variable. It's just that everything after the letter "s" will be printed.
But I can see the whole string "sNumber" in the preview view.
My conclusion is if I want to change it, just modify the string after "s".
try this in your Formula "(""sNumber"") :" if you just need to create it as string

zip code + 4 mail merge treated like an arithmetic expression

I'm trying to do a simple mail merge in Word 2010 but when I insert an excel field that's supposed to represent a zip code from Connecticut (ie. 06880) I am having 2 problems:
the leading zero gets suppressed such as 06880 becoming 6880 instead. I know that I can at least toggle field code to make it so it works as {MERGEFIELD ZipCode # 00000} and that at least works.
but here's the real problem I can't seem to figure out:
A zip+4 field such as 06470-5530 gets treated like an arithmetic expression. 6470 - 5530 = 940 so by using above formula instead it becomes 00940 which is wrong.
Perhaps is there something in my excel spreadsheet or an option in Word that I need to set to make this properly work? Please advise, thanks.
See macropod's post in this conversation
As long as the ZIP codes are reaching Word (with or without "-" signs in the 5+4 format ZIPs, his field code should sort things out. However, if you are mixing text and numeric formats in your Excel column, there is a danger that the OLE DB provider or ODBC driver - if that is what you are using to get the data - will treat the column as numeric and return all the text values as 0.
Yes, Word sometimes treats text strings as numeric expressions as you have noticed. It will do that when you try to apply a numeric format, or when you try to do a calculation in an { = } field, when you sum table cell contents in an { = } field, or when Word decides to do a numeric comparison in (say) an { IF } field - in the latter case you can get Word to treat the expression as a string by surrounding the comparands by double-quotes.
in Excel, to force the string data type when entering data that looks like a number, a date, a fraction etc. but is not numeric (zip, phone number, etc.) simply type an apostrophe before the data.
=06470 will be interpreted as a the number 6470 but ='06470 will be the string "06470"
The simplest fix I've found is to save the Excel file as CSV. Word takes it all at face value then.

lex/yacc won't recognize a string (syntax error)

Hi i'm trying to let lex/yacc split this string
table subwayLines:int[3]
into tokens of table, subwayLines, int[3] with the [3] optional(i.e. int or int[3])
everything is fine until i try to recognize the "int",
so this is what i did in lex
[A-Za-z0-9\[\]]+ { /* column property*/
yylval.sval = (char *)strdup(yytext);
char* temp=yylval.sval;
return STRING;
}
i know the problem is in
[A-Za-z0-9\[\]]+
because when i changed it to
[A-Za-z]+("[")?+[0-9]+("]")?+(",")?
it works except I still can't go without the "[" or "]", for example, if i wrote this in my string:
table subwayLines:int
then it gives me a syntax error
so does anyone knows how to do change it? thanks
To make the [3] optional, this will not work:
[A-Za-z]+("[")?+[0-9]+("]")?+(",")?
You've made only the square brackets optional, but not the number in between. You need something like
[A-Za-z]+("["[0-9]+"]")?
I.e. the entire square-bracketed part is optional.
Also the combination (REGEX)?+ doesn't make much sense (the ?+ part of it). It's equivalent to (REGEX)*, since you're effectively saying that (REGEX) is optional, one or more times, which is like zero or more.
(Not sure why you have the optional comma in the second example; the first one doesn't recognize a comma and it's not shown in your example input.)