
Setting a parameterized view in form's Init
To expand on Fred's correct advice...
To use parameterized views:
1) Put the view in the DE
2) Set its NoDataOnLoad property to .T.
3) In your form code, whenever you need to requery the view (and
thereby populate it with data), prepare the view parameter
variable(s), then issue the requery like so:
LOCAL vMyViewParam
vMyViewParam = 'Some Parameter Value'
REQUERY("myView")
4) If you need to index it, you can. Just select the view
and index it:
SELECT myView
INDEX ON some_col TAG some_tag
After that, you should be able to do a SET RELATION using it
on the child side.
-- TRW
Quote:
> Ben,
> In the DE you have for the cursor the possibility to set the noDatOnLoad
> property to .T. for the view...
> HTH
> Fred
> Ben Hambidge a crit :
> > I want to set the parameter of a parameterized view at the end of a
> > form's Init (until then, I don't know the value that needs to be set).
> > On my first attempt, with the view in the DE, the prompt appears for
> > the user to set the parameter as the view is opened before the
> > parameter is known.
> > On my second attempt, I removed the view from the DE and opened it
> > manually at the end of the Form's Init. However, as the view is also
> > involved as the child in a relation (which I had successfully set up
> > in the DE), on trying to do this manually, it failed as there are no
> > indexes on views, so I couldn't do a SET ORDER TO.
> > Question 1: Is there a way to stop the system asking the user for the
> > parameter value at the early stage, and just requery after I've got
> > the value?
> just initialize the parameter to a value.
> > Question 2: How does the DE set the relation without the index, and
> > how do I mimic this manually?
> > Many thanks
> > Ben
> --
> FE AVP&Cie
> La Rochelle, Europe
--
_______________________________________
My e-mail: t r w 7
_______________________________________