Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Double index
Message
From
05/01/2014 01:23:32
 
 
To
05/01/2014 00:35:38
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01591344
Message ID:
01591345
Views:
110
This message has been marked as the solution to the initial question of the thread.
>I would like to arrange in ascending order the average of two fields af1 and af2
>the solution would be index on af1+af2 to highave
>
>the problem is that some of the records do not have an af2 so for these I would need the index to still place the highest of af1
>together with the averaged af1+af2
>
>is there a way to set up the index such that if af2 =0 then index on af1 only, if af2>0 the index on af1+af2
>
>Can you please let me know if this is possible and a suggestion on how to formulate the code to create this double index
>
>thanks
>k

Karen...maybe "thinking outside the box" on this one.....can you have a derived column in the table that would store the sort value for any one row (based on the values in AF1 and AF2)....and then create the index on that new derived/calculated column?

Maybe a function at the time of a save of a row (or a trigger when a row is saved, or something along those lines), so that any time you save a row, the value in your new calculated column will be updated.

There might be other techniques as well.....but that's one that comes to mind.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform