-
formatting using MagicCell
Hi
I am trying to format a number using MagicCell. I just want to show the whole number without the decimal places. I have used the following:
field=percentAtt|Macro=#percentAtt:format=00#
My output in the column is "format=81"
As you can see, the decimal places have been removed but I am outputting the word "format=". What am I doing wrong?
Thanks
Bob
-
How about ->
field=percentAtt|Macro=Format=#percentAtt:00#
The Format= might be a key work conflict. I'll check.
FK
-
I tried the change but the only difference was it showed the decimal places as well:
Format=71.428500
I tested it with dbGridMagicCell
as well as dbEditMagicCell
Bob
-
Is "00" a good macro for whole number with no decimal or try "##" instead. I'll give it a try also
FK
-
This is what I get by using ##:
Format=66.6
(field=percentAtt|Macro=Format=#percentAtt:###)
-
you must redefine the # wrapper delimiter becasue you are using ## in the macro !!!
FK
-
Frank
I changed the delimiter but it still outputs the 'Format=' text.
-
the following works ->
Dim M As New tornado.z
M.dbQP = "U=1| D=NWIND| Q=Select employeeid from employees"
M.dbMagicCell = "(;,[]!|~/+{})fi=0| Mac=format=!0::##!"
M.ASPdbNET()
-
It works fine with the sample for dbGridMagicCell but NOT with dbEditMagicCell.
-
Something else: I notice in the Classic manual reference is made to the fact that magicCell can trap `divide by zero' error. Have you an example of this for Tornado?
Thanks
-
DBZ has not changed in Tornado. Just make an examlpe with a formula like ->
<<(!Budget! - !Spent!)/ !Budget! * 100:###.##>>
If Budget = 0 the DBZ text (in dbOption) will be displayed. When <<...>> formula is evaluated, the DBZ error will be arrested adn then the DBS text will be displayed.
FK
-
BTW, dbEditMagicCell is implementeded now in C#. It took some effort as Edit cells values are of RAW type. EditMagic only works on NOUPDATE NOADD conditions of course.
Frank
-
Found an example of DBZ. This and many other C# DLL examples will be included in the "Example Files" ZIp filein the coming January download ->
<!--Divide-By_Zero.aspx-->
<script language='vb' runat='server'>
Sub Page_Load(Source as Object, E as EventArgs)
Dim Mydb As New Tornado.Z()
'... Module 1 display the normal Budget Data
With Mydb
.dbQP = "type=Excel| U=1| S=ASPdbBB| D=BudgetSS.xls| ps=-1| TextHolder=Title=MagicCell - Normal| Q=Budget| ni=none"
.ASPdbNET()
'... Module 2 adds a calculated field of available budget % anticipating 'Divide By Zero' problem
.dbQP = "type=Excel| U=2| S=ASPdbBB|D=BudgetSS.xls| ps=-1| TextHolder=Title=MagicCell - Divide By Zero| ni=none| nh=t"
.dbSQL = "SELECT Dept, Budget, Expense, 'dummy' as Available From Budget"
.dbGridMagicCell = "field=3| macro=<<(#Budget#-#Expense#)/#Budget#>>"
.dbOptions="DBZ=No Budget"
.ASPdbNET()
End With
'BudgetSS.xls file ->
'
'Dept Budget Expense
'A 10000 5200
'B 25000 1200
'C 0 750
'D 35000 100
'E 75000 3500
'F 0 2400
End Sub
</script>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|