Results 1 to 15 of 15

Thread: Use MagicCell to compare two field values

Hybrid View

  1. #1
    Join Date
    Jun 2005
    Posts
    11

    Use MagicCell to compare two field values

    How can I get magiccell to use the greater than, or less than logic to compare two fields and display the result in the a different font color.

    IE: if field 1 > field 2 then field 1 should display green, if field 1 < field 2 it should be red.

    I can get it to work using values but not different fields in an sql query.

    Any clues ?

  2. #2
    Join Date
    Oct 2002
    Posts
    933
    1. State product and version - Classic or .Net - EP or GOLD ?
    2. Overall you can use #1# > #2# to compare field 1 and 2 for example.

    FK

  3. #3
    Join Date
    Oct 2002
    Posts
    933
    Just to get you going - here is the latest Tornado code. Classic should be pretty much the same.

    Dim Mag As New Tornado.z
    Mag.dbQP = "u=1|s=1|d=nwind|q=select ProductName,UnitsInStock,UnitsOnOrder from Products| th=ti=MagicCell Compare"
    Mag.dbMagicCell = "fi=1|mac=(#1#|GTN|#2#|class=green~|EL||class=red) "
    Mag.ASPdbNET()


    FK
    Last edited by Frank; 06-11-2005 at 01:48 AM.

  4. #4
    Join Date
    Jun 2005
    Posts
    11
    Frank,

    Classic, ASPDB2002-10.09-SP3-ADO21-MTS-EP

    Obviously the Tornado syntax doesn't fit this version I'm afraid. I tried to use the following but if gave me a type mismatch

    mcell = mcell & "fieldX,Align=left, (#8#|GTN|#9#||<Font color=green><B> </Font>Format=[##]</B> ~ #8#|LTN|#9#||<Font color=red><B> Format=[##]</Font></B>);"

  5. #5
    Join Date
    Oct 2002
    Posts
    93

    Smile

    Hi,

    We have an example that shows just what you're after.

    Please go to: http://www.aspdbtest.com/examples/ep/default.asp and look at examples 2a, 2b, 2c, etc.

    That should do the trick!

    Thanks,
    John

  6. #6
    Join Date
    Jun 2005
    Posts
    11
    Hi John,

    Unfortunately all those examples [whilst useful alright] do not show an effort to compare two fields, they all use values ie: less than 3, or contains x etc.

    What I am trying to do is if #1#|GTN|#2# then ......

    Any ideas ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •