Turn Calculated Field Results into Currency

J

joshbell

Hello,

I am trying to trun some numbers into currency using a calculated value
in a query. Although the result formats the results as currency, it
sorts as a string would. Here is my statement:

Penalty:
IIf([datClaimPaidDate]-[datClaimLtrDate]>30,FormatCurrency(([datClaimPaidDate]-[datClaimLtrDate]-30)*50),"")

Does anyone have any suggestions on how to get this to return as actual
currency that will sort like currency?

Thank you for your help!

jb
 
E

Evertjan.

wrote on 12 dec 2005 in microsoft.public.inetserver.asp.general:
IIf([datClaimPaidDate]-[datClaimLtrDate]>30,FormatCurrency(([datClaimPa
idDate]-[datClaimLtrDate]-30)*50),"")

This is NOT classic ASP, dunno what it is.
 
K

Kyle Peterson

it might be cold fusion from what I remember

Evertjan. said:
wrote on 12 dec 2005 in microsoft.public.inetserver.asp.general:
IIf([datClaimPaidDate]-[datClaimLtrDate]>30,FormatCurrency(([datClaimPa
idDate]-[datClaimLtrDate]-30)*50),"")

This is NOT classic ASP, dunno what it is.


Hello,

I am trying to trun some numbers into currency using a calculated value
in a query. Although the result formats the results as currency, it
sorts as a string would. Here is my statement:

Penalty:
IIf([datClaimPaidDate]-[datClaimLtrDate]>30,FormatCurrency(([datClaimPaidDate]-[datClaimLtrDate]-30)*50),"")

Does anyone have any suggestions on how to get this to return as actual
currency that will sort like currency?

Thank you for your help!

jb
 
D

Dave Anderson

Evertjan. said:
wrote on 12 dec 2005 in microsoft.public.inetserver.asp.general:
IIf([datClaimPaidDate]-[datClaimLtrDate]>30,FormatCurrency(([datClaimPa
idDate]-[datClaimLtrDate]-30)*50),"")

This is NOT classic ASP, dunno what it is.

It certainly *could* be.


<%@ Language=VBScript %><%

Function IIF(Condition,CaseTrue,CaseFalse)
If Condition = True Then
IIF = CaseTrue
Else
IIF = CaseFalse
End If
End Function

datClaimPaidDate = DateAdd("d",45,Now)
datClaimLtrDate = Now

Response.Write(IIF([datClaimPaidDate]-[datClaimLtrDate]>30,_
FormatCurrency(([datClaimPaidDate]-[datClaimLtrDate]-30)*50),""))

%>

Writes "$750.00" to my Response stream.



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 
C

Chris Hohmann

Hello,

I am trying to trun some numbers into currency using a calculated value
in a query. Although the result formats the results as currency, it
sorts as a string would. Here is my statement:

Penalty:
IIf([datClaimPaidDate]-[datClaimLtrDate]>30,FormatCurrency(([datClaimPaidDate]-[datClaimLtrDate]-30)*50),"")

Does anyone have any suggestions on how to get this to return as actual
currency that will sort like currency?

Thank you for your help!

jb

SELECT
IIF([datClaimPaidDate]-[datClaimLtrDate]>30,FormatCurrency(([datClaimPaidDate]-[datClaimLtrDate]-30)*50),"")
AS Penalty
FROM MyTable
ORDER BY
IIF([datClaimPaidDate]-[datClaimLtrDate]>30,([datClaimPaidDate]-[datClaimLtrDate]-30)*50,0)
 
E

Evertjan.

Dave Anderson wrote on 13 dec 2005 in
microsoft.public.inetserver.asp.general:
[datClaimPaidDate]-[datClaimLtrDate]>30

What is the function of the [] in ASP-vbs?

datClaimPaidDate = DateAdd("d",45,Now)
datClaimLtrDate = Now

x = datClaimPaidDate-datClaimLtrDate '45
x = [datClaimPaidDate]-[datClaimLtrDate] '45

x = [datClaimPaidDate-datClaimLtrDate] ' ?? empty string ??
 
D

Dave Anderson

Evertjan. said:
[datClaimPaidDate]-[datClaimLtrDate]>30

What is the function of the [] in ASP-vbs?

Believe it or not, it is an optional enclosure for variable names. You can
use almost any character (including whitespace characters inside there. That
makes this perfectly legal:

Dim ["Date" of()-My.Birth!]
["Date" of()-My.Birth!] = DateSerial(1963,11,23)
Response.Write(DateDiff("yyyy",["Date" of()-My.Birth!],Now))



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 
E

Evertjan.

Dave Anderson wrote on 13 dec 2005 in
microsoft.public.inetserver.asp.general:
Evertjan. said:
[datClaimPaidDate]-[datClaimLtrDate]>30

What is the function of the [] in ASP-vbs?

Believe it or not, it is an optional enclosure for variable names. You
can use almost any character (including whitespace characters inside
there. That makes this perfectly legal:

I knew that only from SQL-strings.

Is it really useful?
Dim ["Date" of()-My.Birth!]
["Date" of()-My.Birth!] = DateSerial(1963,11,23)
Response.Write(DateDiff("yyyy",["Date" of()-My.Birth!],Now))

You are young, Dave!
 
E

Evertjan.

Dave Anderson wrote on 13 dec 2005 in
microsoft.public.inetserver.asp.general:
Evertjan. said:
Is it really useful?

That is certainly a fair question. We frequently see questions about
obfuscation in here, and given the fact that whitespace is allowed, I
can imagine a particularly diabolical scheme in which every variable
name is a mixture of spaces and tabs (or VBScript keywords and
functions).

Dim ["Date" of()-My.Birth!]
["Date" of()-My.Birth!] = DateSerial(1963,11,23)
Response.Write(DateDiff("yyyy",["Date" of()-My.Birth!],Now))

You are young, Dave!

I am, though the above is not my birth date. It is the day everyone in
my parents' generation remembers as a life-defining one.

Ah yes I remember sitting in front of the [B&W] Television.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top