Adding Data to a Form that is not in that forms collection, and save in secondary collection
There must be a common field between both collections to allow them to be joined
1- Go into the destination form (where the data is to be displayed and/or stored) and enter edit mode ( Cntrl - E)
2- Go to Edit - Form Properties
3-Click the collections button, them new collection
4-Type in or browse the IDO Name SYMIX.SLItemCusts in this example
5- In the filter field (not filter form) enter the filter criteria like:
CustNum=FP(DohCustNum) AND Item=FP(CoiOrCoihItem)read as ido coll on the top where CustNum=FP(DohCustNum) AND Item=FP(CoiOrCoihItem)to the left of the = sign is property on the secondary collection to the right is the FILTERPROP of the property on the Primary collection
Then add Event Handlers to Refresh Collection on Each sec coll added
Then Click Parms.. and choose promary collection
Then click type specific parms and choose secondary collection 1
The Event Handler is this cased is added to Event StdObjectSelectCurrentCompleted, ( t
This will then join the data of the primary collection and the secondary collection.
To pass and store data from secondary collection to primary collection (in this example passed from and stored in UDFShortText1)
1- Add two components (otherwise data won't be returned from secondary collection -see select stmt in log) to the form that is displaying the data from the primary collection. The source field in secondary collection and the target field in the primary collection. Both fields should be bound on data to their respective properties
Data Binding of secondary collection property
Make sure on general tab it is hidden notice validator that on secondary collection field
Data Binding on primary collection property
2- Create Validator on secondary collection component that uses script to pass data from
one property to another, make sure to check validate immediately
Properties of Validator
Parms Button
Then Edit
The script
Sub KRSetDoSeqContCode2()
Dim objSC As Cache
Dim objPC As Cache
Dim strContCode As String
'Next line instantiates secondary collection
Set objSC = ThisForm.GetSecondaryCache(2)
'Next Line populates a variable with value of what was in 2nd Coll property
strContCode = objSC.GetCurrentObjectProperty("UDFShortText1")
'Next line takes what was in variable and puts in primary coll property
ThisForm.PrimaryCache.SetCurrentObjectPropertyPlusModifyRefresh ("UDFShortText1"), strContCode
End Sub
3- File Close and return to syteline
4- Save and regenerate the form and test...