Convert the money datatype to a 2 decimal point format.
Whats the best way to convert the money datatype to a 2 decimal point format in ms sql 2005 for use in my applications.
this?
CAST(tr.depositReceivedAmount AS decimal(10 , 2))
I respectfully disagree with the notion that you should change the SQL column from a 'money' data-type to something else.
In most database servers, 'money' is a data type that is designed to provide very consistent behavior with regard to arithmetic accuracy. In Microsoft Access, the representation is a scaled-integer. In MS SQL Server, it is obviously similar. Ditto Oracle and all the others.
You want the money data-type in the database to have this accuracy, because "hell hath no fury like an accountant in search of one lousy penny." The database column storage-formats are designed to satisfy accountants, and that is a Good Thing.
Meanwhile, you also want to take care as to exactly how you deal with the values. There are several points where rounding could take place. You do not have at your disposal the strongest possible handling of floating data-types in ColdFusion. You are also somewhat at the mercy of whatever interface software may lie between you and whatever SQL server you may use. "It's okay to round values once, but not multiple times."
I suggest rounding the value right before display, and stipulating that the user's input must be two decimal places.
Then, you might have to do some things at the SQL server's end. For instance, when you update a value in the table, you may need to use server-side logic to explicitly truncate the value to two decimal-points, so that an update of "$34.56" explicitly updates the column to "$34.5600." (This sort of thing has to happen within the SQL server context.) You know that the user's input has exactly two significant digits, but maybe (maybe not...!) the SQL server might not know this. You want to ensure that the server's internally-stored value represents exactly two significant digits, when the value originates from a user-input.
Don't err on the side of "your convenience" or "what looks good on-screen." (If you do, get ready to get phone-calls from the accountants, always at inopportune hours of the night.)
Similar Messages
-
Hi All,
I want to convert the output of Applescript which is in object format to string or text format, am running Applescript with Java, I need to display the output of applescript in Eclipse Java Console, since its object format the output is not properly displayed..
Pls suggest.. I used the below code
repeat with i in allContents
if class of i is button then set the end of allStaticText to contents of i
end repeat
Applscript ouptput
{button 1 of window "Player Installer" of application process "Install Player" of application "System Events", button 2 of window "Player Installer" of application process "Install Player" of application "System Events", button 3 of window "Player Installer" of application process "Install Player" of application "System Events", button "Finish" of UI element 1 of scroll area 1 of window "Player Installer" of application process "Install Player" of application "System Events"}
Java output
<NSAppleEventDescriptor: 'obj '{ 'form':'indx', 'want':'butT', 'seld':1, 'from':'obj '{ 'form':'name', 'want':'cwin', 'seld':'utxt'(" Player Installer"), 'from':'obj '{ 'form':'name', 'want':'pcap', 'seld':'utxt'("Install Player"), 'from':'null'() } } }>Here's an improved version of the previous script, where the handler now returns "button 2 of window \"Untitled\" of application process \"TextEdit\" of application \"System Events\"" instead of "button \"2\" of window \"Untitled\" of application process \"TextEdit\" of application \"System Events\"":
tell application "System Events"
get button 2 of window 1 of process "TextEdit"
my objectToText(result) --> "button 2 of window \"Untitled\" of application process \"TextEdit\" of application \"System Events\""
end tell
on objectToText(UI_element)
set theText to ""
tell application "System Events"
repeat
if exists attribute "AXParent" of UI_element then
set theParent to value of attribute "AXParent" of UI_element
set theClass to class of UI_element
if name of UI_element exists then
set theName to name of UI_element
set theText to theText & (theClass as text) & " \"" & theName & "\" of "
else
set k to 0
get UI elements of theParent whose class is theClass
repeat with thisItem in result
set k to k + 1
if contents of thisItem is UI_element then exit repeat
end repeat
set theIndex to k
set theText to theText & (theClass as text) & " " & theIndex & " of "
end if
set UI_element to theParent
else
set theClass to class of UI_element
set theName to name of UI_element
set theText to theText & (theClass as text) & " \"" & theName & "\" of application \"System Events\""
exit repeat
end if
end repeat
end tell
return theText
end objectToText
Message was edited by: Pierre L. -
Convert the Database records to a standard XML file format?
Hai,
i want to convert the Database records to a standard XML file
format which includes the schema name, table name, field name
and field value. i am using Oracle 8.1.7. Is there any option
please help me
Thanks in advance.You could put the files somewhere and I can export them as QuickTime. Or you could find anyone you know who has Director. Or do the 30 day trial download
Another approach would be to play the DCR in a browser window, and do a screen recording. But that’s unlikely to give the perfect frame rate that you would get by exporting from Director. -
Converting the script and smartforms to OTF and RDI format.
How to convert the script and smartforms to OTF and RDI format. Please suggest all possible ways.
Please don't cross-post or duplicate-post.
It increases the chances that both threads are deleted faster than what it increases the chances of getting "double-good" answers...
I deleted the other thread.
Thanks,
Julius -
How to dynamically convert the return datatype of a procedure
Hi ,
I want to write a procedure which will take two argument.
one will be string and another one will be a out variable having dynamic return type based on the data in first passing parameter.
Description:
let suppose i have one table which has 3 column
1.String_col1 varchar2 (it will contain String combination of alphabets,numbers)
2.number_col2 varchar2 (it will contain numbers only)
3.date_col3 varchar2 (it will contain DATE)
All columns are having varchar2 as their datatype.(in sort all are String).
now i want to write a procedure which will convert the datatype of all the three columns into their respective datatypes i.e.
1.String_col1 varchar2
2.number_col2 number
3.date_col3 date
Note:I am passing only 1 column in procedure as IN parameter.I dont want to convert 1 row in their respective datatype.
Please let me know if you want any more information from my side.I'm pretty sure that isn't possible.
What you could do is write a function to determine the datatype of the input, and use the return value of that function in either a decode or case statement to determine which of 3 explicitly defined functions to use.
Carl -
Need to convert the binary data in blob field to readable format
Hi,
We need to convert the Binary data in the BLOB field to readable format and need to display it in Oracle Apps Environment,does anybody come across the similar requirement.
please advise, thanks in advance.
Regards,
Babu.You could use standard Attachments functionality here ... if the blob is not in FND_LOBS, insert into FND_LOBS, fnd_attached_documents etc to enable viewing via "Attachments" to the entity the blob is related to.
Gareth -
If I have downloaded all my CD's accidently in AIFF format and created a massive 330gb file on my laptop, can I now convert the downloaded files to AAC format or do I have to re load all the CD's in AAC format.................help?
You can convert them. No need to re-rip the CDs.
The original rip to AIFF maintained all audio quality of the CD. An AAC that you get from converting an AIFF or from re-ripping from CD will be equivalent quality. But since you already have the AIFFs, converting will be much faster.
A few specifics of the conversion process have changed in iTunes 11, so check this guide:
iTunes 11 for Windows: Save a copy of a song in a new file format
Note that the process creates a new AAC but does not remove the original AIFF. If there is no future use for the AIFFs (which I assume is true in your case), you can just delete them from the library after the conversion is done. -
How can I get the windows regional settigs such as Decimal point setting
I have the problem that the Labview program I wrote uses the regional settings to format numbers to string. I know one can change this in 6.0 but I am using instrument drivers and the total library has 200 or more vi in it. I don't have the time to edit all of these. So I would like to check the regional settings and then inform the user that he/she may need to change this, or even that the program will remotly change these settings. Any ideas or example code ?
Another way of reading it is through the registry. Just open a key:
+ Open Registry Key.vi
+ HKEY_CURRENT_USER or HKEY_USERS (root key)
+ Control Panel\International (subkey)
+ read key/write key (security access mask)
Use 'read registry value simply' or 'write registry value simply' to read or
to modify 'sDecimal'.
And remember :
+ to be active in LV, you must restart LV!
+ you should change 'sThousand' also!
+ close the key!
Regards,
Wiebe.
"AIR" wrote in message news:9sdsai$3h3$[email protected]..
> Hi,
>
> One way is to check it:
>
> + use the function 'Number To Fractional String' (Sting>String/Number
> Conversions>Number To Fractional String').
>
> + Wire 'True' constant to 'Use System Decimal Point'.
>
> + The Output sting will be 0.
000000 or 0,000000, according to the regional
> settings.
>
> LV updates this only at start, so if you change it in Windows, you have to
> restart LV!
>
> Regards,
>
> Wiebe.
>
>
>
>
> "jens" wrote in message
> news:[email protected]..
> > I have the problem that the Labview program I wrote uses the regional
> > settings to format numbers to string. I know one can change this in
> > 6.0 but I am using instrument drivers and the total library has 200 or
> > more vi in it. I don't have the time to edit all of these. So I would
> > like to check the regional settings and then inform the user that
> > he/she may need to change this, or even that the program will remotly
> > change these settings. Any ideas or example code ?
>
> -
How can I convert the old AppleWorks files into a modern useable format?
I've been using Mac computers for many years. The most important application (to me) was AppleWorks. But now I have learned that if I upgrade
to Lion all my Appleworks files will be lost. I have searched in many places for the "How to convert AppleWorks files to some format that WILL
be supported by Apple. I see no information on the Apple website and when I speak to a support person, I am always told that AppleWorks is
so very old, it was not included in their training so they cannot tell me anything. The little bits of advice I did get caused all my 20,000 AppleWorks
files to be moved into my LaCie terrabyte external storage file, and at the same time the old files remain in my Macintosh Hard Drive. But in both
places, those files cannot be read any more, and the nicely organized work I had done, was all gone. I mean - my AppleWorks files were always
grouped by folders into special interest sections. Now those folders don't exist and everything is in disarray - and unreadable. The titles of each
file is now greyed out. I have tried
to make the transfer in Bento3 but mostly in iWork06. I was told by Apple staff NOT to buy a higher iWork such as 09 because they are too
far removed from the old AppleWorks to be able to do anything with it. So I've stuck to iWork06 with no success. Also, I went to my favorite
privately owned Apples store and found all their instruction manuals and DVD application files MISSING. Their shelves are empty. I was told
the new way is to order off the internet but....I'd far rather go into a shop and see all they offer for sale. If I had gone there to buy ONE item,
I'd drive away with THREE items, because getting my hands on items was the important way to understand what the value and purpose
of that item is.
To summarize: I have installed iWorks06 with no written information about it. I have iWork08 with an instruction book which never never
mentions AppleWorks, so I have not installed iWork08. I have Bento3 installed, but no instruction book. So I haven't learned or tried anything
because it too never speaks of AppleWorks transfer. Some of my AppleWorks files are extremely important to me. Not just personal or
social but BUSINESS! I won't be able to answer the tax man should he come a-knocking on my door. HELP!!So what kinds of files are they? Word processing docs, from the painting Appleworks app, or spreadsheets?
This is how I've handled it:
Anything word processing: should be able to import them (drag them in or import) into Pages. Worked here.
Spreadsheets: Used File > Open to open an AW spreadsheet. Needs a few adjustments, but I was able to tailor Numbers to get my spreadsheets the way I wanted them. Just experimented for a while with a non-essential spreadsheet until I figured out what to do.
Painting: That is the one I used the most (and continue to do so): Cannot be read by any iWork. If your doc is a finished product, simply save it as a .pdf or .jpg and then you can drag it into Pages. If it is not, then you are out of luck. I am keeping a partition with a bootable Snow Leopard system with Appleworks on it in order to be able to keep creating my stuff because I've not been able to find a somewhat equal substitute.
So, keeping SL on a partition and/or an external drive is one option if necessary. -
Convert data from datatype RAW to Char.
Hi All,
I have a requiement, which has to use a standard report to get the data and add few more custom fields to enhance the output.
I'm using the EXPORTING LIST TO MEMORY AND RETURN approach.
From Zreport I'm calling standard program rakopl02 using SUBMIT rakopl02 EXPORTING LIST TO MEMORY AND RETURN.
and then using below FM's.
CALL FUNCTION 'LIST_FROM_MEMORY'
CALL FUNCTION 'WRITE_LIST'
problem is: in RFC 'WRITE_LIST' , data is displaying in ABAPLIST(structure) which has a field RFCRECORD ( RAW Data type)
field component type data type length
RFCRECORD RFCRECORD_ RAW 1000
need to convert the RAW datatype to Char/String for the requirement.
how do convert the data...
need help on this.
-waiting for d response.Hi Praveen.,
Pls check the below Function Module.,
DATA : t_table1 TYPE STANDARD TABLE OF str_itab,
i_data TYPE STANDARD TABLE OF string.
CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
EXPORTING
in_xstring = l_xstring
IMPORTING
out_string = l_string.
SPLIT l_string AT cl_abap_char_utilities=>newline INTO TABLE i_data.
LOOP AT i_data INTO l_string.
SPLIT l_string AT cl_abap_char_utilities=>horizontal_tab INTO TABLE fields.
READ TABLE fields INTO lv_field INDEX 1.
fs_table-name = lv_field.
READ TABLE fields INTO lv_field INDEX 2.
fs_table-age = lv_field.
READ TABLE fields INTO lv_field INDEX 3.
fs_table-gender = lv_field.
APPEND fs_table TO t_table1.
hope this will help u.,
Thanks & Regards
Kiran -
Hi All,
Is it possible to have the Material: Transaction Qty as 7 decimal points?
Eg. 3.1234567
If so, How to achieve this?
Thanks,
K.Nataraja Suthan,Hi
It would be very complicated to use this as this is at row level and this is probably price or qty and it needs to be calculated every time .
I haven't test it but I think you can use user defined field at row level and use formatted search to get the total .
I know you want to achieve this ,my suggestion would be review your business process and limit it to six digit within SAP limitation .
You can fulfill the request by customization or addon but it will take a lot of effort and other thing is maintenance .
Hope this helps
Bishal -
Query about decimal point field in mapping
hi,
In interface one field is supposed , Both dollars and cents will be formatted with an implied decimal point before the last two digits in the data.
for exm : input is -620.27. then output should be -000062027. Maximum length of the field is 10.
if input is 44.44.then output should be 0000004444.
In this way.
Name of the field is Pay_Amount.
how do i get this mapping?
Regards,
SanghamitraUse the replace string function to replace decimal point with null. Then pass the value to a udf.
Write a udf (value cached) and pass the input a= value from Pay_Amount and b - required length of field (10)
public String AddLeading(String a,String b,Container container){
String temp = new String(String.valueOf(Integer.parseInt(a)));
int temp1 = Integer.parseInt(b);
for(int i = 0; (temp1 - a.length()) > i ; i++)
temp = "0" + temp;
return(temp); -
Aligning decimal points in columns
In my program I am writing I cannot seem to get the output to be formatted in the proper way. I need the columns to have the salary values aligned by their decimal points, by they are aligned to the left instead.
Like this:
Employee 1 2110.45 7-05-2004
Employee 2 55.09 7-05-2004
Employee 3 1100.00 7-05-2004
This is the code I am using to print:
public void printData() throws IOException {
//Variable to read data from the text file
BufferedReader in = new BufferedReader(new FileReader("EmployeeData.txt"));
String str;
Employee emp = new Employee();
//Loop to read data from text file, alter salary, and print to monitor
//Loop while there are lines remaining to read in text file
while ((str = in.readLine()) != null) {
//Variable to break up each line in text file by name, salary, and date
StringTokenizer st = new StringTokenizer(str, "|");
//Loop while there are more elements in the current line
while (st.hasMoreElements()) {
//Retrieve name, salary, and date from the current line
String sName = st.nextToken();
String sSalary = st.nextToken();
String sDate = st.nextToken();
//Call function to calculate salary increase
double val = (new Double(sSalary)).doubleValue();
sSalary = emp.calculateRaise(val);
//Print line to monitor
System.out.println(sName + "\t" + sSalary + "\t" + sDate);
in.close();
}If anyone wants to know how to align decimal points I
found the answer here:
http://leepoint.net/notes-java/25data/25strings/30conve
sion/54num2string.htmlThat is not a true way to align decimal points. It is only a way to right align text. If your decimals are irregular with some being .0, and others .00 or .000 this will not work. But, it will probably work for your problem. -
Hi,
When i call out the query from OITM which has the average price (item cost), the result showed me in 2 decimal points. But in my item master data, it shows 3 decimal points. How can call out a query that shows 3 decimal points? Is there any condition i should use?
Thanks,
Rgds,
HarithHello Harith, I will test this issue on pl36 to see if it's reproducible. anyway, you are always suggested to patch up with the latest patch. I will let you know the result.
Just tested and I got the same result as my previously reply, it shows 3 decimals witch complies with both general settings> decimal places for price and item cost in Item master data.
please try to recall the Avgprice from OITW table to see what you get there.
Thank you.
Wilma Wang
SAP Business One Forums Team -
How to get only two digits after decimal point of an expression
i am doing simple multiplication between two float numbers.
both the numbers have two digits after decimal point.
so naturally the result will have 4 digits after decimal point.
i want to get only two digits after decimal point.
help me please...If you just want to limit the displayed decimal places, you can do the following...
import java.text.*;
public class Formatting {
public static void main(String[] args) {
NumberFormat format = NumberFormat.getNumberInstance();
format.setMaximumFractionDigits(2); //what you seem to want
format.setMinimumFractionDigits(2); //if you always want at least 2 digits displayed
System.out.println(format.format(12.345));
System.out.println(format.format(12.0));
Maybe you are looking for
-
IPod Touch Apps not syncing properly
My iPod Touch won't sync Apps from my computer to the device. I have manual syncing turned on and this has worked for me previously. iOS is better than what is needed for all apps, all apps can be used on the iPod Touch and i have more than 40GB free
-
How to know which transformation code is using the data target..
Hi, Say I have a DSO ZXXX. Now there are transformations for other data targets, where the ABAP code is doing a select on this DSO ZXXX and reading and using that data for the result package. Typically if we wany to know if a DSO is used where where
-
Application builder changes tdms to excel vi
I had a tdms to excel vi that was working great. So I tried to make the whole program into an executable. I have done this before without incident. So I went to close the source program and it asked me if I want to save (most specifically the tdms
-
SWF files stopped working Flash8
Hi, I have uploaded my swf file to the web. It is a video clip . Some of the swf loads on the web (the text part) when I click a button, to load it, but the video does not show ? see page 2 of link below www.geocities/suddentlyisee.com I have load sw
-
Finding exact matches using WITHIN clause or?
We are storing documents in XML format in a CLOB. We need to find exact matches within an element through intermedia. Is there a way we can use the WITHIN clause or a different type of clause to get only exact matches for a phrase? e.g., a search on