- Friedrich Bräuning
- PowerBuilder
- Wednesday, 29 September 2021 11:32 AM UTC
Hello,
we have the following Problem in PB2019 and PB2021:
We have a function which dynamically returns us a nonvisual Object based on a string.
Choose Case as_Type
Case "attrib_1"
attrib_1 lnv_Attrib1
lnv_return = lnv_Attrib1
Case "attrib_2"
attrib_2 lnv_Attrib2
lnv_return = lnv_Attrib2
Case ...
End Choose
These are all AutoInstantiated, which means we can't just use "create using as_Type"
The Problem is, that when we call this function with as_Type = "attrib_2", Powerbuilder creates all NVOs which are autoinstantiated.
Powerbuilder even has this problem when it will never execute the code:
If (1=2) Then
attrib_1 lnv_Attrib1 //attrib_1 is autoinstantiate
End If
Here the constructor of attrib_1 is called, which is just plain false, as Powerbuilder never executes the code of "attrib_1 lnv_Attrib1".
Is there any workaround for this PB-behaviour ?
Is this the intended behaviour of Powerbuilder?
Thanks for your help.
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.