An appearance was requested without a variable text field - itext

I have come across this error while trying to fill in a form field. I really have no idea what it means and only occurs on some of the PDFs that I have.
I found it being thrown from AcroFields.java here:
if (!PdfName.CH.equals(fieldType))
throw new DocumentException("An appearance was requested without a variable text field.");
Could anyone provide insight into this error and what is causing it?

You're using a very old version of iText, please upgrade!
In the most recent version, exceptions are localized:
if (!PdfName.CH.equals(fieldType))
throw new DocumentException(MessageLocalization.getComposedMessage(
"an.appearance.was.requested.without.a.variable.text.field"));
As for your question: the error tells you exactly what is happening. You are setting a value for a field for which two or more appearances are defined. However, the value you've chosen is an invalid value.
For instance: you have a check box for which the possible states are "Off" and "On", but you're trying to set the value "1". There is no appearance defined for the value "1" hence the exception.

Related

Crystal Report: Parameter damages the whole report

While using Crystal Reports I have encountered a strange bug, that repeats itself already with a number of my reports.
I still didn't fully get how I replicate it, but usually it goes as follows:
I add a parameter of any type to an existing report document, however it doesn't appear in a parameter prompt at all.
After I change parameter order in the Parameter Fields Section, my Parameter disappears and instead I see a duplicate of another parameter in a parameter list, and in the "Set Parameter Order"-Window I see this duplicated parameter as [ParameterName, ParameterName]. If I save the document in this moment and try to reopen it, CR crushes.
If I try to load this document in Vstudio with CREngine, the code exits with the message "Access violation".
Here is a pic of what is happening:
The reason you are not being prompted for the new "test" parameter is that it is not used by the report for anything.
The rest of the behavior is indeed strange. Consider removing the '#' character from the name of the first parameter to see if that fixes it.
If some of those parameters are from a stored procedure, perhaps your report is simply out of sync with the data source. Do Database, Verify Database...

SAP Unicode: Offset exceed

I got some account issues in the SCN so I make a attempt here.
We switched to Unicode and got some issues with that. INFTY_TAB = PS+2. This coding gets an error that "the offset + length is exceeding".
I found some hints but couldn't really figure out how to fix this. And even when I manage to fix those errors I got a new error called 'Iclude-Report %HR_P9002 not found'. The IT is still there so is there something else I can check?
Definition of PS:
DATA: BEGIN OF PS OCCURS 0.
*This indicates if a record was read with disabled authority check.
data: authc_disabled(1) type c.
DATA: TCLAS LIKE PSPAR-TCLAS.
INCLUDE STRUCTURE PRELP.
DATA: ACRCD LIKE SY-SUBRC.
DATA: END OF PS.
TCLAS is a char(1) field.
This is the part where the error pops up:
INFTY_TAB = PS+2.
Error: I had to translate so sorry for some mistakes that could appear.
Offset and Length (=2432) exceed the length of the character based beginning (=2430) of the structure.
Depends on the length of INFTY_TAB. You have to explicitly set length:
INFTY_TAB = PS+2(length).
Official information is here. The important point to note is that the inclusion of SY-SUBRC (which is an INT4 field) places a limit to the range of fields you can access using this (discouraged) method of access.
ASSIGN field+off TO is generally forbidden from a syntactical
point of view since any offset <> 0 would cause the range to be
exceeded.
Although the sentence above is related to ASSIGN command, it is also valid for this situation.

Grafana: No value to text mapping

Like you can see in the following screenshot I am trying to map "no value" to text. What I want to achieve is that in the case of "no value" the text "offline" gets displayed. My guess is that "no value" is not the right parameter to map with, but I have no idea whats the right one. I also tryed NaN which doesnt work to.
I would be really happy if someone can point me to the right value here!
Try null instead of no value.
Also, for your 2nd mapping, you could use range to text. You could use range to text for both your mappings actually..
null - null => offline
1 - 1000 => online
You might need to save dashboard and refresh it to see changes. It did not update for me without a refresh (using an older version though).

Munin - how to return unknown value from plugin

I want my munin plugin to report unknown values if the value can't be reported. What do I have to return?
"nan"
"-nan"
nothing at all, just skip returning a value
"unknown"
...?
Nothing works for me.
Background: ntp_offset plugin fails if ntp is not running at all. I want to return unknown value and send an alert message.
I think the correct value to return is "U".
This is briefly mentioned without explanation in the documentation:
http://munin.readthedocs.org/en/latest/reference/plugin.html#plugin-reference

Get statuscode text in C#

I'm using a plugin and want to perform an action based on the records statuscode value. I've seen online that you can use entity.FormattedValues["statuscode"] to get values from option sets but when try it I get an error saying "The given key was not present in the dictionary".
I know this can happen when the plugin cant find the change for the field you're looking for, but i've already checked that this does exist using entity.Contains("statuscode") and it passes by that fine but still hits this error.
Can anyone help me figure out why its failing?
Thanks
I've not seen the entity.FormattedValues before.
I usually use the entity.Attributes, e.g. entity.Attributes["statuscode"].
MSDN
Edit
Crm wraps many of the values in objects which hold additional information, in this case statuscode uses the OptionSetValue, so to get the value you need to:
((OptionSetValue)entity.Attributes["statuscode"]).Value
This will return a number, as this is the underlying value in Crm.
If you open up the customisation options in Crm, you will usually (some system fields are locked down) be able to see the label and value for each option.
If you need the label, you could either do some hardcoding based on the information in Crm.
Or you could retrieve it from the metadata services as described here.
To avoid your error, you need to check the collection you wish to use (rather than the Attributes collection):
if (entity.FormattedValues.Contains("statuscode")){
var myStatusCode = entity.FormattedValues["statuscode"];
}
However although the SDK fails to confirm this, I suspect that FormattedValues are only ever present for numeric or currency attributes. (Part-speculation on my part though).
entity.FormattedValues work only for string display value.
For example you have an optionset with display names as 1, 2, 3,
The above statement do not recognize these values because those are integers. If You have seen the exact defintion of formatted values in the below link
http://msdn.microsoft.com/en-in/library/microsoft.xrm.sdk.formattedvaluecollection.aspx
you will find this statement is valid for only string display values. If you try to use this statement with Integer values it will throw key not found in dictionary exception.
So try to avoid this statement for retrieving integer display name optionset in your code.
Try this
string Title = (bool)entity.Attributes.Contains("title") ? entity.FormattedValues["title"].ToString() : "";
When you are talking about Option set, you have value and label. What this will give you is the label. '?' will make sure that the null value is never passed.