dcsimg
Results 1 to 13 of 13

Thread: formatting using MagicCell

  1. #1
    Join Date
    Feb 2003
    Posts
    62

    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

  2. #2
    Join Date
    Oct 2002
    Posts
    933
    How about ->

    field=percentAtt|Macro=Format=#percentAtt:00#

    The Format= might be a key work conflict. I'll check.

    FK

  3. #3
    Join Date
    Feb 2003
    Posts
    62
    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

  4. #4
    Join Date
    Oct 2002
    Posts
    933
    Is "00" a good macro for whole number with no decimal or try "##" instead. I'll give it a try also

    FK

  5. #5
    Join Date
    Feb 2003
    Posts
    62
    This is what I get by using ##:

    Format=66.6

    (field=percentAtt|Macro=Format=#percentAtt:###)

  6. #6
    Join Date
    Oct 2002
    Posts
    933
    you must redefine the # wrapper delimiter becasue you are using ## in the macro !!!


    FK

  7. #7
    Join Date
    Feb 2003
    Posts
    62
    Frank

    I changed the delimiter but it still outputs the 'Format=' text.

  8. #8
    Join Date
    Oct 2002
    Posts
    933
    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()

  9. #9
    Join Date
    Feb 2003
    Posts
    62
    It works fine with the sample for dbGridMagicCell but NOT with dbEditMagicCell.

  10. #10
    Join Date
    Feb 2003
    Posts
    62
    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

  11. #11
    Join Date
    Oct 2002
    Posts
    933
    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

  12. #12
    Join Date
    Oct 2002
    Posts
    933
    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

  13. #13
    Join Date
    Oct 2002
    Posts
    933
    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
  •