No announcement yet.

Sort on an added field (not in DB table)

  • Filter
  • Time
  • Show
Clear All
new posts

  • Sort on an added field (not in DB table)

    Hi. I have a grid that I have some added fields, which are populated with computations using the onRecord event. All works great. What I want is for these added fields ( integer) to be sorted, so that the higher valued records float to the top of the grid. It does not seem to support sorting properties on added fields. I can only add a ORDER BY in the SQL for actual real fields in the DB table.

    The records need to float to the top, in case the list is long. These are indicating conditions that require operator action.

    These are actually counts from other tables. If I had to, I guess a join of some sort may reproduce a similar table, with the "added" fields being counts generated in the join?????

    Any ideas?

  • #2
    Depending on the database used, you can add calculated (trigger) fields to the sql and thus sort on it. Is that what you want? Something like:

    select sum(value) from (
    select sum(insurance) / count(insurance) as value
    from yourTableName
    group by insurance
    ) temp;
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development /


    • #3
      Hi Albert,
      Thanks. I have not used calculations in SQL, so I may try that. If I can't force a sort using SC somehow on these fields I have added, then I guess doing a JOIN with the original grid table plus some calculated fields form other tables is the way. Nothing ever works the first time