Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sort Browse with Calculated Columns

Status
Not open for further replies.

wchestnut

Programmer
Aug 9, 2010
79
US
I have a Browse list that has 3 tabs and defaults to a key sort by Last Name in the first tab. In this single Browse list, I have 2 columns that are calculating the number of days until their Birthday and Anniversary from the "Format an element of the browse queue" Embed. I need to be able to sort the list (ascending) when clicking on tabs 2 and 3 respectively.

I don't think I can use Conditional Behavior under List Properties because it wants a Key. I'm guessing I'll need to modify a property value and issue some kind of refresh statement in an Embed?
 
Hi!

You cannot sort on a Calculated column. You need to choose the database columns used in the calculated column for sorting.

Regards
 
Interesting... yeah, that won't work if I need to sort by the number of days to their Birthday and Anniversary for the current date because it'll include the year. Maybe I could make some kind of temporary table with the calculated values, then open that file when the browse is called. Thanks again!
 
<<bangs head against wall>>

I'm trying to delete all records in a TPS file:


OPEN(CALCON,2)
LOOP UNTIL EOF(CALCON)
NEXT(CALCON)
DELETE(CALCON)
END


What's wrong with that?
 
NEVERMIND! I found the SET command. Adding that after OPEN seemed to do the trick.
 
Hi!

Also use of EOF() is not recommended as it affects performance.

Use ::

SET(CALCON) or SET(KeyinCALCON)
LOOP
NEXT(CALCON)

IF ERRORCODE() = 33
BREAK
ELSIF ERRORCODE()
MESSAGE(ERRORFILE() & ' : ' & ERROR() & ' [' & ERRORCODE() & ']', 'E R R O R - NEXT()')
BREAK
END

... Delete or whatever you want ...

END

And, if you want to delete ALL records, open the file in exclusive access and do a EMPTY(CALCON).

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top