Re: Validating data, tricky one... by Rush
Rush
Tue Sep 18 15:04:58 PDT 2007
Texeira wrote:
> Hi: I need to validate that records have been entered correctly in a
> table, by correctly I mean in ascending order. But with a small
> variation, the first record can have any value, so:
>
> Field1
> 100
> 2
> 3
> 4
> 5
> 6
>
> This is correct, because record 1 can have any value, but :
>
> Field1
> 88
> 2
> 3
> 7
> 5
> 6
>
> Is wrong, can I validate this using VF
Quite simply, you're heading about it wrong - the physical order of the
records should be immaterial. Instead, use an index or SQL-SELECT to
collect the records in the order that you want:
INDEX ON Field1 TAG Field1
SET ORDER TO Field1
will almost get you there, but that "Record 1" will give you trouble.
You may need a slightly more complex index expression:
INDEX ON (IIF(IsFirstRecord, -1, Field1)) TAG Field1
SET ORDER TO Field1
"IsFirstRecord" would be whatever it is that identifies it as a "First"
record. This is probably not a good approach, as the IIF(...) format
must be used in referring to this tag in order to let Rushmore kick in.
Can you describe your application in more detail? You're approaching a
relational database as though it were a spreadsheet - a common mistake,
and one that will cause you pain.
- Rush