Access childBusinessObject


Author
Message
Chan
Chan
Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

How could I access childbusinessobject from parentbusinessobject? I checked SF source code and found that is a private variable _ChildBusinessObjects. However it is not exposed. Any other way to access it?

Thank you

StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
No, but I will add a property to expose that collection for the next release.  In the meantime, you can add the property and rebuild the source code if you need it.
Chan
Chan
Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

May I know the property name?

Thank you

StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
We'll call it the same as the private field without the _, so probably ChildBusinessObjects.
Randy Jean
Randy Jean
StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)
Group: StrataFrame Users
Posts: 105, Visits: 641
I have a related question... How do I access a parent business object from the child? In the instance of the child? I want to conditionally run some custom currentrowvalidation in the child business object based on a value in the parent.



Thanks.
Peter Jones
Peter Jones
Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)
Group: Forum Members
Posts: 386, Visits: 2.1K
Hi,

I think that would be simply:

me.ParentBusinessObject....

Cheers, Peter


Ben Hayat
Ben Hayat
Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)
Group: Forum Members
Posts: 374, Visits: 1.2K
Randy Jean (06/04/2007)
I have a related question... How do I access a parent business object from the child? In the instance of the child? I want to conditionally run some custom currentrowvalidation in the child business object based on a value in the parent.



Thanks.




How about:

ParentFormName.MyBO



Should give you access to it!

..ßen
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Either of the samples given to you from Peter or Ben Hayat would work.  Since a child BO has to have the parent instance set, you can just access that property directly. 

MyChildBO.ParentBusinessObject

Randy Jean
Randy Jean
StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)
Group: StrataFrame Users
Posts: 105, Visits: 641
but... I need to access a value on the business object and at design time it's not there so I can't compile. I'm from the loosely typed dynamic world of VFP where this type of thing isn't an issue so I'm still confused with where/how to reference things at design time.



So, for instance, I want to do the following in my child CheckRulesOnCurrentRow:







If Me.ParentBusinessObject.InstrumentName = "Atlas" Then ' <- Compile time error due to ParentBusinessObject doesn't exist at design time

If Not CheckOnePortActive(Me.CurrentRowIndex) then

Me.AddBrokenRule(PortSetupBoFieldNames.Activate,"Only one port can be active for this instrument.")

End If

End If


Randy Jean
Randy Jean
StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)
Group: StrataFrame Users
Posts: 105, Visits: 641
I tried this and it compiles but at runtime oParentBiz is NULL:





Dim oParentBiz As InstrumentSetupBO

oParentBiz = CType(Me.ParentBusinessObject, InstrumentSetupBO)

If oParentBiz.InstrumentName = "Atlas" Then

If Not CheckOnePortActive(Me.CurrentRowIndex) Then

Me.AddBrokenRule(PortSetupBOFieldNames.Activate, "Can only have 1 active port on Atlas.")

End If

End If


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search