Solved

Formating of a Field

Posted on 2003-10-30
14
210 Views
Last Modified: 2013-12-18
Im trying to format a field and I use the code below.

mac = Format$(doc.cash(0), "###,###,##0.00")

For example, the value of the field doc.cash(0) = 29454.7, the value of mac should be 29,454.70, but its not working

Help!!
0
Comment
Question by:makuletski
  • 3
  • 3
  • 2
  • +4
14 Comments
 
LVL 13

Expert Comment

by:CRAK
Comment Utility
What is returned to mac?
Did you DIM mac as string?
Did you specify a thousand-separator in your OS (I assume you did for decimals)? If you didn't ("" is an option!) it won't show!
0
 
LVL 15

Expert Comment

by:Bozzie4
Comment Utility
What is not working ?

You can try it out by putting this in a button

Sub Click(Source As Button)
      Msgbox Format$( 24754.7, "###,###,##0.00")
End Sub

and

Sub Click(Source As Button)
      Msgbox Format$( "24754.7", "###,###,##0.00")
End Sub

If that gives the right result, there may be something 'wrong' with the input.  If your field is a text field, and not a number, you should be aware of the international settings ( eg.  decimal delimiter, thousands separator).  

cheers,

Tom
0
 
LVL 9

Expert Comment

by:Arunkumar
Comment Utility
500 for formatting ?  Dont you think too much guys ?  Share it with me...
0
 
LVL 31

Expert Comment

by:qwaletee
Comment Utility
Arun,

If you walk over to makuletski's desk, and implement either CRAK's or Bozzie's suggestions, then I'm sure they would be glad to share the points.
0
 
LVL 24

Expert Comment

by:HemanthaKumar
Comment Utility
I believe you are trying to set a field value called mac !?!? Right ?

For that use this code

Dim ws as new NotesUIworkspace
dim note as NotesDocument
set note = ws.CurrentDocument.Document
mac = Format$(doc.cash(0), "###,###,##0.00")
note.Mac = mac


~Hemanth
0
 
LVL 31

Expert Comment

by:qwaletee
Comment Utility
You know, in all this, I just realized: makuletski never really told us what's wrong.  What are theresults? How does he know it is wrong? Where is the mac variable's value used?
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 13

Expert Comment

by:CRAK
Comment Utility
Exactly! I still don't know what result arrived at mac.

This could have been solved so easy (and more important for me as 1st respondent: quietly... )! I was hoping to reach the premium services threshold. Don't you all grant me continued subscription?

Arun, you're right. It is a very generous donation, but at least some of us try to EARN these points. Will you ever change?  ;-))

Makuletski, what are you trying to archieve anyway? Hemanths suggestion writes the value (formatted) to a field. You could do a similar thing by just using the (numerical) fields properties (2nd tab). Perhaps there's an easier solution for what you try to do!
0
 

Author Comment

by:makuletski
Comment Utility
actually guys, i assigned 500 points for the questions coz i need it the same day i posted it. however i found out eventually what the problem is....this is the next line in my code..

mac = Format$(doc.cash(0), "###,###,##0.00")
param1 = Cstr(Abs(mac)

what i did was delete the Abs function and it worked out ok.

about the points, will it be ok if i just split the points to each one of u since all of you took the time to asnwer my query? (and so the next time i ask, you guys can help me asap! lol ;) )
0
 
LVL 31

Expert Comment

by:qwaletee
Comment Utility
go ahead.  or just get a refund.
0
 
LVL 13

Expert Comment

by:CRAK
Comment Utility
I agree with qwaletee
0
 
LVL 24

Expert Comment

by:HemanthaKumar
Comment Utility
If you have noticed my code you would have got that clue. I din't make any changes to the format as you did before using that value. So it is always better if you give us block of code for review.. so ball is in your court I can accept points or you can have the points I don't have any objection
0
 

Accepted Solution

by:
modulo earned 0 total points
Comment Utility
PAQed - no points refunded (of 500)

modulo
Community Support Moderator
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now