Hi Jozef,
>Solution with using makro works only in conjunction with cursorfill method.
????
It works with
cursorrefresh. I have done it.
look at my Example
LOCAL;
lcMacro AS CHARACTER,;
loAdapter AS CURSORADAPTER
CREATE CURSOR myTable (c1 C(1), c2 C(3))
INSERT INTO myTable VALUES ("A","1")
INSERT INTO myTable VALUES ("B","2")
INSERT INTO myTable VALUES ("C","3")
loAdapter = NEWOBJECT('captest')
lcMacro = ''
loAdapter.CURSORFILL()
SELECT (loAdapter.ALIAS)
BROWSE
lcMacro = 'ORDER BY 1 DESC'
loAdapter.CURSORREFRESH()
BROWSE
DEFINE CLASS capTest AS CURSORADAPTER
PROCEDURE INIT
THIS.ALIAS = 'capTest'
THIS.DATASOURCE = 'Native'
THIS.DATASOURCETYPE = 'Native'
THIS.SELECTCMD = "SELECT * FROM MyTable &lcMacro"
ENDPROC
ENDDEFINE
all what you have to care is, that SELCTCMD holds the
&lcMacro, not the expanded string.
Agnes
>I was looking for something that work in conjunction with cursorrefresh method because I want to avoid repopulating columns of a grid displaying data from the cursor as it must be done in case of usuing cursorfill method.
>Repopulating columns of the grid is quite easy and it seems that I will do that because cursorrefresh method is not as smart as I thought it is.
>Have a nice day !
>
>>Good Morning Jozef!
>>
>>What I do is to add a macro to the SELECTCMD like
>>
>>
>>.SELECTCMD = "SELECT * FROM MyTable &lcMacro'
>>
>>
>>There should exist no var named
lcMacro in the moment you execute the command above!
>>
>>Before CursorFill and CursorRefresh set
lcMacro to a appropriate value, even to an empty string.
>>
>>(This as well will do very dynamic WHERE clauses, that is what I use it for)
>>
>>
>>HTH
>>Agnes
>>
>>>Hi !
>>>1.I want to change "order by ..." clause - included in cursoradapter SelectCmd property - based on a selection made by user. After making such change how should I refresh underlaying cursor ? CursorRefresh method seems not work in such case ( cursorFill works but it close the cursor and destroy grid layout).
>>>2. I wonder why it is not possible to make such things using parameters like it is in case of 'where ...' clause. Does anybody knows the reason.
>>>'Order by' clause look simpler than 'where ...' clause
>>>
>>>Thanks in advance.
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord
Weeks of programming can save you hours of planning.
OffThere is no place like [::1]