-
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 ?
-
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
-
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.
-
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>);"
-
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
-
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 ?
-
what is the value of your #8# and #9# that have type mismatch error. Are they numbers or strings?
Frank
-
They are integer formats but only contain values of say 30 and 35.
-
Then GTN should work. I'll look into that.
Frank
-
Thanks Frank, appreciate it.
Tim
-
I checked the source and it seems not there !!! The#># was not converted adn in Number, they become a mismatch.This must be added in the Dotnet versions. I'll see what takes to incorporate inot that or youcan upgrade to DotNet versions. Check with sales/support later on for the status.
FK
-
tuns out to be pretty easy fix, just send the valueMacro thru the MagicFilter. Check with sales/support for the next release that includes is feature.
FK
-
got an immediate solution w/o any fix. use the equation to subtract field one and two ->
<%
Set X=Server.CreateObject("ASP.db")
X.dbUnit=2002
'X.dbDSN="provider=Microsoft.Jet.OLEDB.3.51; data source=c:\uno\dev\nwind\nwind.mdb"
x.dbdat="localhost,northwind,sa,sa"
X.dbDBType="SQL"
X.dbMode="Grid"
X.dbGridinc=10
X.dbSQL="select ProductName,UnitsInStock,UnitsOnOrder from Products"
X.dbGridTableTag="BORDER=2 Cellspacing=2"
X.dbMagicCell = "1,,(<<#1#-#2#>>|GTN|0|BGCOLOR=green|#1#~|EL||BGCOLOR=Red)"
X.ASPdb
%>
-
Frank, that works a treat, thanks a heap !
I have another question but will ask it in another thread.
Again, thanks a lot.
-
pleae consider the upgrade to ASP-db.Net... works a lot better (re-written in C# ) no session var leak possibilities. Faster and just better over all. Many new improvement like StoredProc, GridEdit etc....
Frank
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
|
|