Returned query values are different type in FastReport 4 - firebird

I am trying to get a numeric value of my firebird sql query.
In IBExpert the data types are correct "Numeric(18,2)" but when it comes to FastReport it displays me not the Numeric18,2 datatype. It cuts the ,00 off.
Anybody who can help me?

Your data is retrieved properly, you need just to display it well formatted.
Set the display format of the text box as described in documentation.
If the text box contains different formats for multiple values you need to use inline formatting for each value.

Related

In PostgreSQL, is it possible to have a default format for real columns?

In PostgreSQL, I have a column with people's height in meters. If the height is, say 1.75 m, it shows properly, but if the height is 1.70 m, it shows as 1.7. I would like to have this already formatted to two decimal places, showing as 1.70 without formatting in each and every SQL call. Can I specify this in the table creation? Or a stored procedure, or something? I've seen a few things about timestamps, but not for real fields. Knowing how to format the decimal point as a colon (1,70) would be a plus.
Basically, presentation and "cosmetics" are the job of the application, not the database.
Having a default number of decimal places for floats would also create a problem, because the data returned by the database would not be the actual data in the column. So if you did a SELECT and it returned a value of 1.75, then if you searched for this value, you might not find it because the actual value stored was not 1.75 but 1.7499999999 and it was only rounded for display.
Potential solutions:
If you want to store a specified number of digits, use NUMERIC. This will solve the 1.7499999999 problem above. If you use NUMERIC, when doing a SELECT you get the actual contents of the column.
In your app, if you use an ORM, use a Decimal (or similar) type for the column with the appropriate settings so it displays the way you want.
Or create a view with the format applied to the column, but in this case if you want the trailing zero, the type will be text and not float, and it will not be searchable unless you create an extra index on it.
Generated column with the number formatted as you want, maybe easier than a view

Reading Date from Database in the incorrect Format

I have a date fields in a SQL database which are stored in date and datetime2 format.
When executing the Read method on the SmartObject linked to this table, it tries to force the date into an American Format (MDY), and either display this date if it is valid, or fails to show anything (i.e. if the day is above 12)
However, when executing the List method, the data seems to display correctly, as it does when using the SmartObjectTester to execute the Read method on the object.
Is there a way to prevent this from happening, and to have the Date field be read in DMY format, and thus display correctly?
You can change the Data Type of the Field and in the Style Builder Change the "Date and Time" setting to use the format you need. Its always best to use User Settings. Style Builder for Date
This problem came from having the configuration of the Web.config set up to use a different culture to the one which the server K2 was installed on is using.
To solve this, ensure they are the same, and the Server should be able to read from the DB correctly, and thus display on the SmartForms without switching the dates around.
The relevant line to change in the Web.Config is
<add key="SmartObject.ExecutionCulture" value="en-US" />

numeric fields added with single quote in jasper generated excel file

I'm designing a jasper report with the field type & text field type as double.
When run the jrxml file using jasperreports4.7.jar for excel format,
it'll add a single quote in numeric columns.
so i can't do any numeric manipulation in excel.but same is working fine in jasperreports3.jar.
is anyone facing the same issue?
pls help me
What you need to do is to define the field you want to print as an Integer or Double. (You must set your Report to java)
If I do not know yet what type of field is comming I am making, lets say 3 fields, one String, one Integer, one Double. Then I pass the info the what it is dynamically to another -meta-field.
In the designer I lay all 3 fields over each other. Seems to work.

Crystal Report - unable to use TEXT type as a parameter?

I am currently developing a website, asp.net 4.0 using crystal reports, I can view the report perfectly etc, however when trying to create parameters in the report I am unable to select or even view TEXT type fields in my database table when selecting a field to create the parameter from. Selecting string or integers etc work fine, but all TEXT type fields arent even visible.
Any ideas as to why this may be? I need to add a parameter from a TEXT field as we want to limit the results to all messages which contain a certain phraze, and that message is stored in a sql database as a TEXT type.
You have to convert Text type into varchar(max) and then it will be show.
Otherwise you have to add Custom Parameter field and read this value into the parameter and this parameter will drag on your report design page.
You will need to create a parameter that is a 'String' type.
Next, cast your TEXT value to different type using a SQL Expression:
//{%converted_text}
(
cast( TEXT AS varchar2(255) )
)
You may need to adjust the syntax (I'm using Oracle's).
Finally, reference each in the record-selection formula:
{%converted_text} = {?text_prompt}

Accounting format issue when exporting

I have managed to get the report I am working on looking how I would like, setting a column to display using the accounting format which works perfectly when previewing/printing.
However when I try and export this it loses this accounting format and defaulting to it's original format.
I am using version CR 11.5.10.1263
In Crystal Reports
From Exported PDF
Setting accounting format
Strange.
This is a hack, but you could replace the field with two separate fields, one on the left which displays only the currency symbol, and another on the right which displays only the number.