Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community

At 10 JUN 2003 09:37:54PM Jonathan Bird wrote:

Is there a switch/option/property that will allow SORTEDCOL in EDITTABLEs to sort properly on dates and amounts? ie, use the ICONVed value of the column values. Or do we still have to do it ourselves using V119, and if so, being rather lazy, has anyone got a routine to do it generically?

Ta,

J


At 11 JUN 2003 12:46PM Richard Hunt wrote:

Jonathan,

It is not so hard. Try this…

* Remove trailing empty rows.

RESULT=ETMETHOD(ET_FOCUS,'TRIM')

*

* Disable redraw. RESULT=SET_PROPERTY(ET_FOCUS,'REDRAW',0) *

* Get the conversion code from the edit table column.

CONV=GET_PROPERTY(ET_FOCUS,'CONV')

*

* Internal convert the column. IF CONV NE THEN ARRAY=GET_PROPERTY(ET_FOCUS,'ARRAY') ARRAY=ICONV(ARRAY,CONV) RESULT=SET_PROPERTY(ET_FOCUS,'ARRAY',ARRAY) END * * Sort the column. RESULT=SET_PROPERTY(ET_FOCUS,'SORTEDCOL',ET_COLUMN:@FM:SORT_METHOD) * * Output convert the edit table column. IF CONV NE THEN ARRAY=GET_PROPERTY(ET_FOCUS,'ARRAY') ARRAY=OCONV(ARRAY,CONV) RESULT=SET_PROPERTY(FOCUS,'ARRAY',ARRAY) END *

* Enable redraw.

RESULT=SET_PROPERTY(ET_FOCUS,'REDRAW',1)


At 12 JUN 2003 06:11PM Jonathan Bird wrote:

Thanks, Richard.


At 13 JUN 2003 07:36AM Dave Berkovsky wrote:

Hi Richard,

Can you explain how to remove trailing emply rows and to

make sure that there no emply rows in between.

TIA


At 13 JUN 2003 10:13AM Richard Hunt wrote:

Dave,

To remove trailing empty rows I use the sentence…

RESULT=ETMETHOD(ET_FOCUS,'TRIM')

To make sure thate are no empty rows in between… I do not know.

I protect my edit tables and use dialog boxes to prompt the user. That way I have control over appending, copying, cutting, deleting, inserting, modifying, and pasting rows or single cells. So I never have empty rows in between or partially entered rows.


At 13 JUN 2003 02:03PM Oystein Reigem wrote:

Dave,

I have some edit tables with a similar issue. These edit tables have two data columns. One of the columns (the second one) must be filled in for the row to be valid. If that column isn't filled the whole row should go. In your case it's empty rows that should go. So it's quite similar.

As long as the user is still working with the edit table I let him do what he wants. Cleanup doesn't happen until the edit table's LOSTFOCUS.

The LOSTFOCUS situation of my edit table actually is a bit complex, because there are two buttons that "belong" to the edit table. These two buttons are option buttons that bring up popups with recommended values for the two columns. I can't have the LOSTFOCUS cleanup stuff hit in when the user just clicks an option button. So I check for that in the LOSTFOCUS handler, and if the new control is one of the buttons, the LOSTFOCUS handler doesn't do anything. Also the CLICK handlers of the two buttons automatically return focus to the edit table, or else the user could sneak away from the edit table via one of the buttons without activating cleanup. Also the buttons don't follow the edit table in tab order, or else the user could sneak away with a Ctrl+tab from the edit table to a button without activating the button's CLICK. (Phew!)

But if the edit table's LOSTFOCUS handler decides it's really time for cleaning up it runs the following subroutine:

subroutine ET_Cleanup( ETCtrlName, MandatoryColNo )

$insert Logical

declare function Get_Property

declare function Set_Property

declare function Send_Message

List=Get_Property( ETCtrlName, "LIST" )

/* how many rows of data? */

NumRows=…(I use a function of my own here)…

/* clean one row at a time. do it from the bottom up */

for RowNo=NumRows to 1 step -1

if List=" then

/* mandatory column not filled in. delete the row */

UnUsed=Send_Message( ETCtrlName, "DELETE", RowNo )

/* but append a blank row at the end,

 for looks (you might not want that) */

UnUsed=Send_Message( ETCtrlName, "INSERT", -1, "" )

end

next RowNo

return

Perhaps you can tweak my solution to fit your needs.

- Oystein -


At 15 JUN 2003 06:42AM Dave Berkovsky wrote:

Oystein,

Thank you very much for you advice. I have same situation and

certainly I can use approach. Thank you again.

Dave


At 17 JUN 2003 06:37AM Richard Guise wrote:

FWIW …

Just been readdressing this issue here as I have quite a few edit tables I want to keep sorted automatically (often on dates). Question is - when to sort - when user changes an entry in the sorted column or on lostfocus?

I think it is more intuitive for the user if the table reorders when he has changed something in the sort column. Hence I put sort routine as CHANGED quickevent. However, I need to know which cell was changed and SELPOS from quickevent gets value of new cursor position not the one just edited. Hence a simple CHAR quickevent to set table property @SELPOS with the position of the item being edited.

Then, if cell edited is not in sort column, do nothing. If it is, sort table (byt whatever means). However, I've found that, if you change table at CHANGED event, iconv error condition doesn't work. Hence I have to check this as part of the sort routine and abandon sort if input is invalid.

Nextly, how to sort the table. I often link an edit table column to a hidden edit line so as to (apparently) zoom and edit long text notes associated with the edit table (another story!). Thus I must reorder the data in the hidden field to match. Hence I cannot use SORTEDCOL and have had to "do my own thing".

Hope this helps someone out there!


At 17 JUN 2003 06:59AM Dave Berkovsky wrote:

Richard,

My Edittable consists of several database bound columns and one

symbolic that is calculated based on three other columns in editable.

Function LostFocus(CtrlEntId,CtrlClassId,Flag,FocusId)

success=ETMethod (CtrlEntId, "TRIM", "", "")
Forward_Event()

RETURN 1

If I insert blank line and tab out from edittable once everything

seems to work fine. Empty row is removed, but if I do it twice then what is happening is empty row is removed but calculated column is not

shifting up with the rest. Do you have any idea what am I doing wrong?

Thanks for your help.

Dave

View this thread on the forum...

  • third_party_content/community/commentary/forums_nonworks/6bf305487942126f85256d420008f6d7.txt
  • Last modified: 2023/12/28 07:40
  • by 127.0.0.1