Parameterized View - Can we open multiple instances using aliases?
Posted on 2010-03-29
I have a parameterized view (called ACCOUNT_PRICESET) which works as advertised.
However, in one of my routines, I open the view and use it update other versions of the same view.
(if it helps to understand, the first view is the Price Rules for a head office and we need to create a copy of that set of rules for each subsidiary account assigned to that head office. Why? Because the subsidiaries are allowed to modify some of the rules but their starting point is what the head office negotiated)
The parameter is simply the Account Reference (PRICESETS.ACCREF=?startit.current_accref is the SQL code). So I open the head office view with the parameter set to the head office account ref. Then I change "startit.current_accref" to one of the subsidiary accounts and use the following command
USE VIZBIZ!ACCOUNT_PRICESET AGAIN IN 0 ALIAS SUBACCOUNT
expecting a new small view consisting, this time, of the subsidiary's price set records.
Instead, what I'm getting is another copy of the Head Office records, despite the change in parameters.
This is, I think, the first time I've tried opening a parameterized view while there is already one open, so perhaps I'm breaking some rule I don't know about or, perhaps there is a procedure that will accomplish what I need in some other way.
I could, for example, set up an identical view with a different name, just for this purpose, which would be simple enough, but I'd like to understand why I can't do it as above...