Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
AddViewParameter enhancement?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00400165
Message ID:
00401556
Views:
19
Hi Doug,

But then if I'm going to be manipulating the array anyway I might as well forego the addviewparameter() method alltogether, don't you think?

I just realized that I posted this message in the wrong category; it actually belongs in mmortals. I'll repost it there to see what others have to say about this.

Thanks!

Alex


>I see what you are saying, but I don't really understand why you would need to do that. Normally, you just add view parameters in the BizObj's PostInitHook().... IOW, you only add the ones you need upon initialization.
>
>Are you saying that you don't know what the view parameters for the BizObj will need to be? Is that why you need to do it at run time?
>
>At any rate, you can get around this by just manipulating the array on your own.
>
>>Hi Doug,
>>
>>Maybe I wasn't very clear... I've been doing it like you suggest (assigning the value to a property and then assiging the property to the parameter).
>>
>>Let me give you an example of what I have in mind:
>>
>>I would like to be able to issue the following command:
>>
>>mybizobj.addviewparameter("my_parameter", 123)
>>
>>* After this, the param array will have:
>>     {"my_parameter, 123}
>>
>>If I now issue:
>>
>>mybizobj.addviewparameter("my_parameter", 999)
>>
>>* The param array will now be:
>>     {"my_parameter, 123}
>>     {"my_parameter, 999}
>>
>>* and so on.
>>
>>
>>
>>Instead, I think it would be nice if AddViewParameter would be a bit smarter, and instead of adding a new element to the array, update the existing one.
>>
>>This way I won't need to add a new property to my form or know that my view parameter expects to find its value in a specific place. I could simply change the value directly on the fly.
>>
>>Thanks!
>>
>>Alex
>>
>>>Hi Alex,
>>>
>>>Currently, the view parameters do get updated with the current value of the property (or whatever you specify) when you run the BizObj's Requery() method. The Requery() method has code in it to assign the value of the second parameter passed to the AddViewParameter method to the first parameter of the AddViewParameter method.
>>>
>>>For example:
>>>AddViewParameter("vp_MyParam", "ThisForm.MyParam")
>>>
>>>When the Requery() of the biz obj is called, vp_MyParam gets assigned the value of ThisForm.MyParam.
>>>
>>>What I like to do, is create a property on my BizObj to store the value for the view parameter, instead of using the form. This just makes it easier to use the biz obj when you move it away from the interface. Using my example, that would be:
>>>AddViewParameter("vp_MyParam", "This.MyParam")
>>>
>>>HTH
>>>
>>>>Hi,
>>>>
>>>>I've been thinking and tinkering...
>>>>
>>>>I looked at the code in the AddViewParameter method of kbiz and noticed that it blindly adds parameters to the array.
>>>>
>>>>Wouldn't it be a good idea if it was a bit smarter and if you passed it the name of a parameter already in the list, it updated the existing element?
>>>>
>>>>Right now, what I'm doing whenever I have a parameter whose value might change is to assign it to a property of the form and then keep changing the property as I need, but I thought it would be easier to simply build some smarts into the bizobj and have AddViewParameter deal with changes as well as additions.
>>>>
>>>>What do you think?
>>>>
>>>>Alex
Low-carb diet not working? Try the Low-food diet instead!
Previous
Reply
Map
View

Click here to load this message in the networking platform